

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>scitools.easyviz.common &mdash; SciTools 0.8.3 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '0.8.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="top" title="SciTools 0.8.3 documentation" href="../../../index.html" />
    <link rel="up" title="Module code" href="../../index.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../../np-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../../index.html">SciTools 0.8.3 documentation</a> &raquo;</li>
          <li><a href="../../index.html" accesskey="U">Module code</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <h1>Source code for scitools.easyviz.common</h1><div class="highlight"><pre>
<span class="kn">import</span> <span class="nn">pickle</span><span class="o">,</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">operator</span><span class="o">,</span> <span class="nn">pprint</span>

<span class="kn">from</span> <span class="nn">scitools.numpyutils</span> <span class="kn">import</span> <span class="n">seq</span><span class="p">,</span> <span class="n">iseq</span><span class="p">,</span> <span class="n">asarray</span><span class="p">,</span> <span class="n">ones</span><span class="p">,</span> <span class="n">zeros</span><span class="p">,</span> <span class="n">sqrt</span><span class="p">,</span> <span class="n">shape</span><span class="p">,</span> \
     <span class="n">ravel</span><span class="p">,</span> <span class="n">meshgrid</span><span class="p">,</span> <span class="n">rank</span><span class="p">,</span> <span class="n">squeeze</span><span class="p">,</span> <span class="n">reshape</span><span class="p">,</span> <span class="n">ndgrid</span><span class="p">,</span> <span class="n">size</span>
<span class="kn">from</span> <span class="nn">scitools.numpytools</span> <span class="kn">import</span> <span class="n">arrmin</span><span class="p">,</span> <span class="n">arrmax</span><span class="p">,</span> <span class="n">NumPyArray</span>
<span class="kn">from</span> <span class="nn">scitools.globaldata</span> <span class="kn">import</span> <span class="n">backend</span>

<span class="kn">from</span> <span class="nn">misc</span> <span class="kn">import</span> <span class="n">_check_xyz</span><span class="p">,</span> <span class="n">_check_xyuv</span><span class="p">,</span> <span class="n">_check_xyzuvw</span><span class="p">,</span> <span class="n">_check_xyzv</span><span class="p">,</span> \
     <span class="n">_check_size</span><span class="p">,</span> <span class="n">_check_type</span><span class="p">,</span> <span class="n">_toggle_state</span><span class="p">,</span> <span class="n">_update_from_config_file</span>

<span class="kn">from</span> <span class="nn">warnings</span> <span class="kn">import</span> <span class="n">warn</span>


<div class="viewcode-block" id="docadd"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.docadd">[docs]</a><span class="k">def</span> <span class="nf">docadd</span><span class="p">(</span><span class="n">comment</span><span class="p">,</span> <span class="o">*</span><span class="n">lists</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Format a string, intended to be appended to or inserted in a doc</span>
<span class="sd">    string, containing a comment and a nicely formatted sequence of</span>
<span class="sd">    lists. Typically used for adding lists of options to a doc string,</span>
<span class="sd">    where the lists of options are available as static list data in</span>
<span class="sd">    a class.</span>

<span class="sd">    Example on usage:</span>
<span class="sd">    # add to the class doc string:</span>
<span class="sd">    __doc__ += docadd(&#39;Keywords for the setp method&#39;, _local_attrs.keys())</span>

<span class="sd">    # add to a method (get) doc string:</span>
<span class="sd">    get.__doc__ += docadd(&#39;Keywords for the setp method&#39;,</span>
<span class="sd">                          BaseClass._local_attrs.keys(),</span>
<span class="sd">                          SomeSubClass._local_attrs.keys())</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">lst</span> <span class="o">=</span> <span class="p">[]</span>
    <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">lists</span><span class="p">:</span>
        <span class="n">lst</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">l</span><span class="p">)</span>
    <span class="n">lst</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
    <span class="n">s</span> <span class="o">=</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span> <span class="o">+</span> <span class="n">comment</span> <span class="o">+</span> <span class="s">&#39;:</span><span class="se">\n</span><span class="s">&#39;</span>
    <span class="n">s</span> <span class="o">+=</span> <span class="s">&#39; &#39;</span> <span class="o">+</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="n">lst</span><span class="p">)[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>  <span class="c"># strip off leading [ and trailing ]</span>
    <span class="c"># add indent:</span>
    <span class="n">indent</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&#39;indent&#39;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
    <span class="n">indent</span> <span class="o">=</span> <span class="s">&#39; &#39;</span><span class="o">*</span><span class="n">indent</span>
    <span class="n">lines</span> <span class="o">=</span> <span class="n">s</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)):</span>  <span class="c"># skip first 2 lines (heading)</span>
        <span class="k">if</span> <span class="n">lines</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span> <span class="o">!=</span> <span class="s">&#39;&#39;</span><span class="p">:</span>
            <span class="n">lines</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">indent</span> <span class="o">+</span> <span class="s">&#39;- &#39;</span> <span class="o">+</span> <span class="n">lines</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>  <span class="c"># add - for list syntax in some markup languages</span>
    <span class="n">s</span> <span class="o">=</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">s</span>

</div>
<div class="viewcode-block" id="MaterialProperties"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.MaterialProperties">[docs]</a><span class="k">class</span> <span class="nc">MaterialProperties</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Storage of various properties for a material on a PlotProperties object.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;opacity&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ambient&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;diffuse&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;specular&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;specularpower&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="MaterialProperties.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.MaterialProperties.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="n">key</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
</div>
<div class="viewcode-block" id="MaterialProperties.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.MaterialProperties.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &quot;</span><span class="si">%s</span><span class="s">&quot;&#39;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>        <span class="p">)</span>

</div></div>
<div class="viewcode-block" id="PlotProperties"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties">[docs]</a><span class="k">class</span> <span class="nc">PlotProperties</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Storage of various properties needed for plotting, such as line types,</span>
<span class="sd">    surface features, contour values, etc.</span>
<span class="sd">    Different subclasses (Line, Surface, Contours) are specialized</span>
<span class="sd">    for different kinds of plots.</span>

<span class="sd">    All properties are stored in the dictionary self._prop.</span>

<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_colors</span> <span class="o">=</span> <span class="s">&quot;b g r m c y k w&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_markers</span> <span class="o">=</span> <span class="s">&quot;o + x * s d v ^ &lt; &gt; p h .&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_linestyles</span> <span class="o">=</span> <span class="s">&quot;: -. -- -&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_sizes</span> <span class="o">=</span> <span class="s">&quot;1 2 3 4 5 6 7 8 9&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_styledoc</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;y&#39;</span><span class="p">:</span> <span class="s">&#39;yellow&#39;</span><span class="p">,</span>
                 <span class="s">&#39;m&#39;</span><span class="p">:</span> <span class="s">&#39;magenta&#39;</span><span class="p">,</span>
                 <span class="s">&#39;c&#39;</span><span class="p">:</span> <span class="s">&#39;cyan&#39;</span><span class="p">,</span>
                 <span class="s">&#39;r&#39;</span><span class="p">:</span> <span class="s">&#39;red&#39;</span><span class="p">,</span>
                 <span class="s">&#39;g&#39;</span><span class="p">:</span> <span class="s">&#39;green&#39;</span><span class="p">,</span>
                 <span class="s">&#39;b&#39;</span><span class="p">:</span> <span class="s">&#39;blue&#39;</span><span class="p">,</span>
                 <span class="s">&#39;w&#39;</span><span class="p">:</span> <span class="s">&#39;white&#39;</span><span class="p">,</span>
                 <span class="s">&#39;k&#39;</span><span class="p">:</span> <span class="s">&#39;black&#39;</span><span class="p">,</span>

                 <span class="s">&#39;.&#39;</span><span class="p">:</span> <span class="s">&#39;point&#39;</span><span class="p">,</span>
                 <span class="s">&#39;o&#39;</span><span class="p">:</span> <span class="s">&#39;circle&#39;</span><span class="p">,</span>
                 <span class="s">&#39;x&#39;</span><span class="p">:</span> <span class="s">&#39;x-mark&#39;</span><span class="p">,</span>
                 <span class="s">&#39;+&#39;</span><span class="p">:</span> <span class="s">&#39;plus&#39;</span><span class="p">,</span>
                 <span class="s">&#39;*&#39;</span><span class="p">:</span> <span class="s">&#39;star&#39;</span><span class="p">,</span>
                 <span class="s">&#39;s&#39;</span><span class="p">:</span> <span class="s">&#39;square&#39;</span><span class="p">,</span>
                 <span class="s">&#39;d&#39;</span><span class="p">:</span> <span class="s">&#39;diamond&#39;</span><span class="p">,</span>
                 <span class="s">&#39;v&#39;</span><span class="p">:</span> <span class="s">&#39;triangle (down)&#39;</span><span class="p">,</span>
                 <span class="s">&#39;^&#39;</span><span class="p">:</span> <span class="s">&#39;triangle (up)&#39;</span><span class="p">,</span>
                 <span class="s">&#39;&lt;&#39;</span><span class="p">:</span> <span class="s">&#39;triangle (left)&#39;</span><span class="p">,</span>
                 <span class="s">&#39;&gt;&#39;</span><span class="p">:</span> <span class="s">&#39;triangle (right)&#39;</span><span class="p">,</span>
                 <span class="s">&#39;p&#39;</span><span class="p">:</span> <span class="s">&#39;pentagram&#39;</span><span class="p">,</span>
                 <span class="s">&#39;h&#39;</span><span class="p">:</span> <span class="s">&#39;hexagram&#39;</span><span class="p">,</span>

                 <span class="s">&#39;-&#39;</span><span class="p">:</span> <span class="s">&#39;solid&#39;</span><span class="p">,</span>
                 <span class="s">&#39;:&#39;</span><span class="p">:</span> <span class="s">&#39;dotted&#39;</span><span class="p">,</span>
                 <span class="s">&#39;-.&#39;</span><span class="p">:</span><span class="s">&#39;dashdot&#39;</span><span class="p">,</span>
                 <span class="s">&#39;--&#39;</span><span class="p">:</span><span class="s">&#39;dashed&#39;</span><span class="p">,</span>
                 <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="s">&#39;Valid symbols::</span><span class="se">\n</span><span class="s">      - Colors: </span><span class="si">%s</span><span class="se">\n</span><span class="s">      - Markers: </span><span class="si">%s</span><span class="se">\n</span><span class="s">      - Linestyles: </span><span class="si">%s</span><span class="se">\n</span><span class="s">      - Sizes: </span><span class="si">%s</span><span class="se">\n</span><span class="s">      - Styles:</span><span class="se">\n</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">_colors</span><span class="p">,</span> <span class="n">_markers</span><span class="p">,</span> <span class="n">_linestyles</span><span class="p">,</span> <span class="n">_sizes</span><span class="p">,</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="n">_styledoc</span><span class="p">)[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>

    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;description&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;legend&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;xlim&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="s">&#39;ylim&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="s">&#39;zlim&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;dims&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;numberofpoints&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="s">&#39;function&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="c"># the function that created this item</span>
        <span class="s">&#39;linecolor&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;linewidth&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;linetype&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;linemarker&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;facecolor&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;edgecolor&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;pointsize&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
        <span class="s">&#39;material&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;memoryorder&#39;</span><span class="p">:</span> <span class="s">&#39;yxz&#39;</span><span class="p">,</span>  <span class="c"># FIXME: this is deprecated and will be removed</span>
        <span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="s">&#39;ij&#39;</span><span class="p">,</span>  <span class="c"># &#39;xy&#39; is Cartesian indexing, &#39;ij&#39; matrix indexing</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;material&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">MaterialProperties</span><span class="p">()</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">props</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
            <span class="n">prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">prop</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">,</span><span class="n">NumPyArray</span><span class="p">))</span> <span class="ow">and</span> \
                   <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">prop</span><span class="p">))</span> <span class="o">&gt;</span> <span class="mi">3</span><span class="p">:</span>
                <span class="n">props</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;</span><span class="si">%s</span><span class="s"> with shape </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">prop</span><span class="p">),</span> <span class="n">shape</span><span class="p">(</span><span class="n">prop</span><span class="p">))</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">props</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="n">props</span><span class="p">)</span>

    <span class="c"># repr is maybe not smart since</span>
    <span class="c"># &gt;&gt;&gt; plot(...)</span>
    <span class="c"># will then return Line, Surface,</span>
    <span class="c"># etc which automatically gets printed.</span>
    <span class="c"># Better to make a dump function</span>
    <span class="c"># that one can call on the current figure f.ex.</span>
    <span class="c">#def __repr__(self):</span>
    <span class="c">#    return self.__str__()</span>

<div class="viewcode-block" id="PlotProperties.dump"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties.dump">[docs]</a>    <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Dump the parameters of this object.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="PlotProperties.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Set plot properties.</span>

<span class="sd">        The method adds the argument value to the self._prop</span>
<span class="sd">        (if the value is legal).</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">descr</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">descr</span>
            <span class="c"># descr is on the form &#39;mesh: 3D mesh&#39; (say)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">descr</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;:&#39;</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;legend&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;linewidth&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linewidth&#39;</span><span class="p">],</span> <span class="s">&#39;linewidth&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linewidth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linewidth&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;linecolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">color</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">color</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="ow">and</span> <span class="n">color</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_colors</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">color</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">color</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;linecolor must be &#39;</span><span class="si">%s</span><span class="s">&#39;, not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_colors</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]))</span>

        <span class="k">if</span> <span class="s">&#39;linetype&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_linestyles</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;linetype must be &#39;</span><span class="si">%s</span><span class="s">&#39;, not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_linestyles</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]))</span>

        <span class="k">if</span> <span class="s">&#39;linemarker&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_markers</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;linemarker must be &#39;</span><span class="si">%s</span><span class="s">&#39;, not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_markers</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]))</span>

        <span class="k">if</span> <span class="s">&#39;facecolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;facecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;facecolor&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;edgecolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;edgecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;edgecolor&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;memoryorder&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Keyword argument &#39;memoryorder&#39; is deprecated and will be &quot;</span> \
                  <span class="s">&quot;removed in the future. Please use the &#39;indexing&#39; keyword &quot;</span> \
                  <span class="s">&quot;argument instead.&quot;</span>
            <span class="n">warn</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="ne">DeprecationWarning</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;memoryorder&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;xyz&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;ij&#39;</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;memoryorder&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;xyz&#39;</span>
            <span class="k">elif</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;memoryorder&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;yxz&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;xy&#39;</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;memoryorder&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;yxz&#39;</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;memoryorder must be &#39;xyz&#39; or &#39;yxz&#39;, not </span><span class="si">%s</span><span class="s">&quot;</span>\
                                 <span class="o">%</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;memoryorder&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;indexing&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;xy&#39;</span><span class="p">,</span> <span class="s">&#39;ij&#39;</span><span class="p">]:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;indexing must be &#39;xy&#39; or &#39;ij&#39;, not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> \
                                 <span class="o">%</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">])</span>

        <span class="c"># set material properties:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;material&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="PlotProperties.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prm_name</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Return the value of the parameter with name prm_name.</span>
<span class="sd">        If the name is None, the dictionary with all parameters</span>
<span class="sd">        is returned.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="n">prm_name</span> <span class="o">==</span> <span class="s">&#39;memoryorder&#39;</span><span class="p">:</span>
            <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Keyword argument &#39;memoryorder&#39; is deprecated and will be &quot;</span> \
                  <span class="s">&quot;removed in the future. Please use the &#39;indexing&#39; keyword &quot;</span> \
                  <span class="s">&quot;argument instead.&quot;</span>
            <span class="n">warn</span><span class="p">(</span><span class="n">msg</span><span class="p">,</span> <span class="ne">DeprecationWarning</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">prm_name</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">prm_name</span><span class="p">]</span>
            <span class="k">except</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &quot;</span><span class="si">%s</span><span class="s">&quot;&#39;</span> <span class="o">%</span> \
                               <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="PlotProperties.setformat"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties.setformat">[docs]</a>    <span class="k">def</span> <span class="nf">setformat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">format</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Extract the right values for color, linetype, marker, etc. given</span>
<span class="sd">        a Matlab-like format string for a curve (e.g., &#39;r-&#39;).</span>
<span class="sd">        The extracted values are stored in self._prop (with keys like</span>
<span class="sd">        &#39;linecolor&#39;, &#39;linetype&#39;, etc.).</span>

<span class="sd">        Erroneous chars will be ignored.</span>
<span class="sd">        When there are multiple format characters for a property, the last</span>
<span class="sd">        one will count.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">format</span><span class="p">,</span><span class="nb">str</span><span class="p">)</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">format</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">color</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
            <span class="n">linetype</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
            <span class="n">marker</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
            <span class="n">linewidth</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
            <span class="n">pointsize</span> <span class="o">=</span> <span class="s">&quot;&quot;</span>
            <span class="c"># Notice that &#39;--&#39; and &#39;-.&#39; are before &#39;-&#39; in the _linestyles</span>
            <span class="c"># alphabet.</span>

            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_linestyles</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">format</span><span class="p">:</span>
                    <span class="n">linetype</span> <span class="o">=</span> <span class="n">item</span>
                    <span class="k">break</span>

            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">format</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_colors</span><span class="p">:</span>
                    <span class="n">color</span> <span class="o">=</span> <span class="n">item</span>
                <span class="k">elif</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_markers</span><span class="p">:</span>
                    <span class="k">if</span> <span class="n">item</span> <span class="o">==</span> <span class="s">&#39;.&#39;</span><span class="p">:</span>
                        <span class="k">if</span> <span class="p">(</span><span class="s">&#39;.&#39;</span> <span class="ow">in</span> <span class="n">linetype</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span><span class="n">format</span><span class="o">.</span><span class="n">count</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">):</span>
                            <span class="k">pass</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">marker</span> <span class="o">=</span> <span class="n">item</span> <span class="c"># same as &#39;.&#39;</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">marker</span> <span class="o">=</span> <span class="n">item</span>
                <span class="k">elif</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sizes</span><span class="p">:</span>
                    <span class="c"># this int describes pointsize or linewidth</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;pointsize&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">item</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linewidth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">item</span>

            <span class="k">if</span> <span class="n">color</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_colors</span> <span class="ow">or</span> <span class="n">color</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">print</span> <span class="s">&quot;Illegal line color choice, </span><span class="si">%s</span><span class="s"> is not known&quot;</span> <span class="o">%</span> <span class="n">color</span>
            <span class="k">if</span> <span class="n">linetype</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span> <span class="ow">or</span> <span class="n">marker</span> <span class="o">!=</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">linetype</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_linestyles</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">linetype</span>
                <span class="k">elif</span> <span class="n">linetype</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linetype&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">linetype</span> <span class="c"># Since marker is known</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">print</span> <span class="s">&quot;Illegal line style choice, </span><span class="si">%s</span><span class="s"> is not known&quot;</span> <span class="o">%</span> \
                          <span class="n">linetype</span>
                <span class="k">if</span> <span class="n">marker</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_markers</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">marker</span>
                <span class="k">elif</span> <span class="n">marker</span> <span class="o">==</span> <span class="s">&quot;&quot;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linemarker&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">marker</span> <span class="c"># Since linetype is known</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">print</span> <span class="s">&quot;Illegal line marker choice, </span><span class="si">%s</span><span class="s"> is not known&quot;</span> <span class="o">%</span> \
                          <span class="n">marker</span>
</div>
<div class="viewcode-block" id="PlotProperties.get_limits"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.PlotProperties.get_limits">[docs]</a>    <span class="k">def</span> <span class="nf">get_limits</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Return limits on the x, y, and z axis:</span>
<span class="sd">        xmin, xmax, ymin, ymax, zmin, zmax.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xlim&#39;</span><span class="p">]</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ylim&#39;</span><span class="p">]</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">]</span>
</div>
    <span class="k">def</span> <span class="nf">_set_lim</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">adj_step</span><span class="o">=</span><span class="mf">0.03</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">amin</span> <span class="o">=</span> <span class="n">arrmin</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
            <span class="n">amax</span> <span class="o">=</span> <span class="n">arrmax</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
        <span class="k">except</span> <span class="ne">ValueError</span><span class="p">:</span>
            <span class="n">amin</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">a</span><span class="p">))</span>
            <span class="n">amax</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">a</span><span class="p">))</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">amax</span> <span class="o">-</span> <span class="n">amin</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="c">#print &#39;empty %s-range [%g,%g], adjusting to [%g,%g]&#39; % \</span>
            <span class="c">#      (name[0], amin, amax, amin-adj_step, amax+adj_step)</span>
            <span class="n">amin</span> <span class="o">-=</span> <span class="n">adj_step</span><span class="p">;</span>  <span class="n">amax</span> <span class="o">+=</span> <span class="n">adj_step</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">amin</span><span class="p">,</span><span class="n">amax</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Line"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Line">[docs]</a><span class="k">class</span> <span class="nc">Line</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Storage of information about lines in curve plots.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;zdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Line</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<div class="viewcode-block" id="Line.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Line.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Set line properties. Legal keyword arguments: x, y, format.</span>
<span class="sd">        The x and y arguments hold the x and y points of a curve.</span>
<span class="sd">        The format string is just passed on to setformat, which parses the</span>
<span class="sd">        contents and sets the format information.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="c"># Here x,y values can be any SequenceType</span>
        <span class="c"># The proper casting should be in the backends plotroutine</span>

        <span class="k">if</span> <span class="s">&#39;z&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;z&#39;</span><span class="p">]):</span>
                <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Can only plot sequence types, &quot;</span>\
                                <span class="s">&quot;z is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;z&#39;</span><span class="p">]))</span>
            <span class="n">z</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;z&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="s">&#39;format&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">setformat</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;format&#39;</span><span class="p">])</span>
            <span class="k">if</span> <span class="s">&#39;y&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>  <span class="c"># will only set y variable if z is set</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span> <span class="nb">basestring</span><span class="p">)</span> \
                       <span class="ow">and</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                    <span class="c"># now y is the indicies of z</span>
                    <span class="n">y</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]):</span>
                        <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Can only plot sequence types, &quot;</span>\
                                        <span class="s">&quot;y is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]))</span>
                    <span class="n">y</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="s">&#39;x&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>  <span class="c"># will only set x variable if y is set</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span> <span class="nb">basestring</span><span class="p">)</span> \
                       <span class="ow">and</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                    <span class="c"># now x is the indicies of y</span>
                    <span class="n">x</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]):</span>
                        <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Can only plot sequence types, &quot;</span>\
                                        <span class="s">&quot;x is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]))</span>
                    <span class="n">x</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span>

            <span class="c"># Consitency check</span>
            <span class="k">assert</span> <span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="n">size</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> \
                   <span class="s">&#39;Line.setp: x has size </span><span class="si">%d</span><span class="s">, expected y to have size </span><span class="si">%d</span><span class="s">, &#39;</span> \
                   <span class="s">&#39;not </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
            <span class="k">assert</span> <span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="n">size</span><span class="p">(</span><span class="n">z</span><span class="p">),</span> \
                   <span class="s">&#39;Line.setp: x has size </span><span class="si">%d</span><span class="s">, expected z to have size </span><span class="si">%d</span><span class="s">, &#39;</span> \
                   <span class="s">&#39;not </span><span class="si">%d</span><span class="s">&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>

            <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>

        <span class="k">elif</span> <span class="s">&#39;y&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]):</span>
                <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Can only plot sequence types, &quot;</span>\
                                <span class="s">&quot;y is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]))</span>
            <span class="n">y</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="s">&#39;format&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">setformat</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;format&#39;</span><span class="p">])</span>
            <span class="k">if</span> <span class="s">&#39;x&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>  <span class="c"># will only set x variable if y is set</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span> <span class="nb">basestring</span><span class="p">)</span> \
                       <span class="ow">and</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                    <span class="c"># now x is the indicies of y</span>
                    <span class="n">x</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]):</span>
                        <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Can only plot sequence types, &quot;</span>\
                                        <span class="s">&quot;x is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="nb">type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]))</span>
                    <span class="n">x</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span>

            <span class="c"># Consitency check</span>
            <span class="k">assert</span> <span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="n">size</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> \
                   <span class="s">&#39;Line.setp: x has size </span><span class="si">%d</span><span class="s">, expected y to have size </span><span class="si">%d</span><span class="s">, &#39;</span> \
                   <span class="s">&#39;not </span><span class="si">%d</span><span class="s">.&#39;</span> <span class="o">%</span> <span class="p">(</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="n">size</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>

            <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
</div>
    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">z</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> <span class="mi">1</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Bars"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Bars">[docs]</a><span class="k">class</span> <span class="nc">Bars</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Properties of bars in bar graphs.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;barwidth&#39;</span><span class="p">:</span> <span class="mf">0.8</span><span class="p">,</span>
        <span class="s">&#39;barstepsize&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
        <span class="s">&#39;barticks&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;rotated_barticks&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Bars</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

<div class="viewcode-block" id="Bars.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Bars.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;barwidth&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barwidth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;barwidth&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;barstepsize&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barstepsize&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;barstepsize&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;barticks&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barticks&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;barticks&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;rotated_barticks&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;rotated_barticks&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">bool</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;rotated_barticks&#39;</span><span class="p">])</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="c"># allow both bar(...,LineSpec,width) and bar(...,width,LineSpec):</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">)</span> <span class="ow">and</span> <span class="n">arg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_colors</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;linecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">arg</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">)):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barwidth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>    <span class="c"># bar(x,Y)</span>
            <span class="n">x</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="n">y</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barticks&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>  <span class="c"># bar(Y)</span>
            <span class="n">y</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
                <span class="n">a</span> <span class="o">=</span> <span class="p">[]</span>
                <span class="n">keys</span> <span class="o">=</span> <span class="n">y</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
                <span class="n">keys</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
                <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">keys</span><span class="p">:</span>
                    <span class="n">a</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">y</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">values</span><span class="p">())</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;barticks&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">keys</span>
                <span class="n">y</span> <span class="o">=</span> <span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
            <span class="n">x</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">y</span><span class="p">))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Bars._parseargs: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">x</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
            <span class="k">pass</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">asarray</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">asarray</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
        <span class="n">n</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">n</span>

</div>
<div class="viewcode-block" id="Surface"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Surface">[docs]</a><span class="k">class</span> <span class="nc">Surface</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Properties of surfaces in scalar field plots.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;cdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;wireframe&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
        <span class="s">&#39;contours&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;zdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Surface</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;meshc&#39;</span><span class="p">,</span> <span class="s">&#39;surfc&#39;</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;contours&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Contours</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">],</span>
                                              <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">],</span>
                                              <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">],</span>
                                              <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

<div class="viewcode-block" id="Surface.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Surface.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;wireframe&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wireframe&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;wireframe&#39;</span><span class="p">])</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">3</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">4</span><span class="p">:</span> <span class="c"># mesh(X,Y,Z) or mesh(x,y,Z)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">_check_xyz</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">3</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">2</span><span class="p">:</span> <span class="c"># mesh(Z)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">_check_xyz</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">indexing</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Surface._parseargs: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">or</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">4</span><span class="p">:</span> <span class="c"># mesh(...,C)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
        <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nx</span><span class="o">*</span><span class="n">ny</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;mesh&#39;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wireframe&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>

</div>
<div class="viewcode-block" id="Contours"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Contours">[docs]</a><span class="k">class</span> <span class="nc">Contours</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about contours for plot of scalar fields.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;cvector&#39;</span><span class="p">:</span>   <span class="bp">None</span><span class="p">,</span>   <span class="c"># vector of contour heights</span>
        <span class="s">&#39;clevels&#39;</span><span class="p">:</span>   <span class="mi">8</span><span class="p">,</span>      <span class="c"># default number of contour levels</span>
        <span class="s">&#39;clabels&#39;</span><span class="p">:</span>   <span class="bp">False</span><span class="p">,</span>  <span class="c"># display contour labels</span>
        <span class="s">&#39;clocation&#39;</span><span class="p">:</span> <span class="s">&#39;base&#39;</span><span class="p">,</span> <span class="c"># location of cntr levels (surface or base)</span>
        <span class="s">&#39;filled&#39;</span><span class="p">:</span>    <span class="bp">False</span><span class="p">,</span>  <span class="c"># fill contours</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span>     <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ydata&#39;</span><span class="p">:</span>     <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;zdata&#39;</span><span class="p">:</span>     <span class="bp">None</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Contours</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

<div class="viewcode-block" id="Contours.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Contours.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;cvector&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">],</span> <span class="s">&#39;cvector&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">,</span><span class="n">NumPyArray</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;clevels&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">clevels</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">clevels</span><span class="p">,</span> <span class="s">&#39;clevels&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="n">cvector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">cvector</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">clevels</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">cvector</span><span class="p">):</span>
                <span class="n">clevels</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">cvector</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">clevels</span>

        <span class="k">if</span> <span class="s">&#39;clabels&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clabels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;clabels&#39;</span><span class="p">])</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span> <span class="c"># contour(...,LineSpec)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">setformat</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]);</span>  <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">3</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">4</span><span class="p">:</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">_check_xyz</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">3</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">_check_xyz</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">indexing</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Contours._parseargs: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">or</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">4</span><span class="p">:</span>
            <span class="n">tmp</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">operator</span><span class="o">.</span><span class="n">isSequenceType</span><span class="p">(</span><span class="n">tmp</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmp</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span>
                    <span class="s">&quot;Contours._parseargs: expected array or integer for &quot;</span> \
                    <span class="s">&quot; argument </span><span class="si">%d</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">nargs</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">tmp</span><span class="p">)))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
        <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">z</span><span class="p">))</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;contour3&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clocation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;surface&#39;</span>
        <span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;contourf&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;filled&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>

</div>
<div class="viewcode-block" id="VelocityVectors"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.VelocityVectors">[docs]</a><span class="k">class</span> <span class="nc">VelocityVectors</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about velocity vectors in a vector plot.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;arrowscale&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
        <span class="s">&#39;filledarrows&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;zdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># grid components</span>
        <span class="s">&#39;udata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;vdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;wdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># vector components</span>
        <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">VelocityVectors</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

<div class="viewcode-block" id="VelocityVectors.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.VelocityVectors.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;arrowscale&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;arrowscale&#39;</span><span class="p">],</span> <span class="s">&#39;arrowscale&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;arrowscale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;arrowscale&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;filledarrows&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;filledarrows&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;filledarrows&#39;</span><span class="p">])</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="c"># allow both quiver(...,LineSpec,&#39;filled&#39;) and quiver(...,&#39;filled&#39;,LS):</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">2</span><span class="p">):</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;filled&#39;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;filledarrows&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span><span class="p">;</span>  <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">setformat</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]);</span>  <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>

        <span class="n">z</span><span class="p">,</span> <span class="n">w</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span>
        <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span>
        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">6</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">7</span><span class="p">:</span> <span class="c"># quiver3(X,Y,Z,U,V,W)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span> <span class="o">=</span> <span class="n">_check_xyzuvw</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">6</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">4</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">5</span><span class="p">:</span> <span class="c"># quiver(X,Y,U,V) or quiver3(Z,U,V,W)</span>
            <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;quiver3&#39;</span><span class="p">:</span>
                <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span> <span class="o">=</span> <span class="n">_check_xyzuvw</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">4</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyuv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">4</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;quiver&#39;</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">2</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">3</span><span class="p">:</span> <span class="c"># quiver(U,V)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyuv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">2</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span>
                <span class="s">&quot;VelocityVectors._parseargs: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">func</span> <span class="o">==</span> <span class="s">&#39;quiver3&#39;</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">7</span><span class="p">))</span> <span class="ow">or</span> \
               <span class="p">(</span><span class="n">func</span> <span class="o">==</span> <span class="s">&#39;quiver&#39;</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">5</span><span class="p">)):</span> <span class="c"># quiver?(...,arrowscale)</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="s">&#39;arrowscale&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;arrowscale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span><span class="p">)</span>

<div class="viewcode-block" id="VelocityVectors.scale_vectors"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.VelocityVectors.scale_vectors">[docs]</a>    <span class="k">def</span> <span class="nf">scale_vectors</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">as_</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;arrowscale&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">as_</span><span class="p">:</span>
            <span class="n">u</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;udata&#39;</span><span class="p">]</span>
            <span class="n">v</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;vdata&#39;</span><span class="p">]</span>
            <span class="n">w</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wdata&#39;</span><span class="p">]</span>
            <span class="n">dims</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span>
            <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_limits</span><span class="p">()</span>
            <span class="n">dx</span> <span class="o">=</span> <span class="p">(</span><span class="n">xmax</span> <span class="o">-</span> <span class="n">xmin</span><span class="p">)</span><span class="o">/</span><span class="n">dims</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
            <span class="n">dy</span> <span class="o">=</span> <span class="p">(</span><span class="n">ymax</span> <span class="o">-</span> <span class="n">ymin</span><span class="p">)</span><span class="o">/</span><span class="n">dims</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="n">d</span> <span class="o">=</span> <span class="n">dx</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="n">dy</span><span class="o">**</span><span class="mi">2</span>
            <span class="k">if</span> <span class="n">w</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">dz</span> <span class="o">=</span> <span class="p">(</span><span class="n">zmax</span> <span class="o">-</span> <span class="n">zmin</span><span class="p">)</span><span class="o">/</span><span class="nb">max</span><span class="p">(</span><span class="n">dims</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span><span class="n">dims</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                <span class="n">d</span> <span class="o">+=</span> <span class="n">dx</span><span class="o">**</span><span class="mi">2</span>
            <span class="k">if</span> <span class="n">d</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">if</span> <span class="n">w</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                    <span class="n">length</span> <span class="o">=</span> <span class="n">sqrt</span><span class="p">((</span><span class="n">u</span><span class="o">/</span><span class="n">d</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">v</span><span class="o">/</span><span class="n">d</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">w</span><span class="o">/</span><span class="n">d</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">length</span> <span class="o">=</span> <span class="n">sqrt</span><span class="p">((</span><span class="n">u</span><span class="o">/</span><span class="n">d</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span> <span class="o">+</span> <span class="p">(</span><span class="n">v</span><span class="o">/</span><span class="n">d</span><span class="p">)</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
                <span class="n">maxlen</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">length</span><span class="o">.</span><span class="n">flat</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">maxlen</span> <span class="o">=</span> <span class="mi">0</span>

            <span class="k">if</span> <span class="n">maxlen</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                <span class="n">as_</span> <span class="o">=</span> <span class="n">as_</span><span class="o">*</span><span class="mf">0.9</span><span class="o">/</span><span class="n">maxlen</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">as_</span> <span class="o">=</span> <span class="n">as_</span><span class="o">*</span><span class="mf">0.9</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;udata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">u</span><span class="o">*</span><span class="n">as_</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;vdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span><span class="o">*</span><span class="n">as_</span>
            <span class="k">if</span> <span class="n">w</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">w</span><span class="o">*</span><span class="n">as_</span>
</div>
    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">z</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;udata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">u</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;vdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">w</span>
        <span class="k">if</span> <span class="n">rank</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">u</span><span class="p">),</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">rank</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">u</span><span class="o">.</span><span class="n">shape</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">u</span><span class="p">))</span>

</div>
<div class="viewcode-block" id="Streams"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Streams">[docs]</a><span class="k">class</span> <span class="nc">Streams</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about stream lines, stream tubes, and similar</span>
<span class="sd">    vector field visualization techniques.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;stepsize&#39;</span><span class="p">:</span> <span class="mf">0.1</span><span class="p">,</span>
        <span class="s">&#39;numberofstreams&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="s">&#39;tubes&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;tubescale&#39;</span><span class="p">:</span> <span class="mf">1.0</span><span class="p">,</span>
        <span class="s">&#39;n&#39;</span><span class="p">:</span> <span class="mi">20</span><span class="p">,</span> <span class="c"># number of points along the circumference of the tube</span>
        <span class="s">&#39;ribbons&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;ribbonwidth&#39;</span><span class="p">:</span> <span class="mf">0.5</span><span class="p">,</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;zdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>    <span class="c"># grid components</span>
        <span class="s">&#39;udata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;vdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;wdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>    <span class="c"># vector components</span>
        <span class="s">&#39;startx&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;starty&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;startz&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># starting points</span>
        <span class="p">}</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Streams</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

<div class="viewcode-block" id="Streams.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Streams.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="s">&#39;stepsize tubescale ribbonwidth&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="n">key</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>

        <span class="c"># set whether we should use lines, tubes, or ribbons:</span>
        <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;tubes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamtube&#39;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ribbons&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamribbon&#39;</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="c"># TODO: do more error checking and add support for indexing=&#39;ij&#39;.</span>
        <span class="n">z</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="n">sz</span><span class="p">,</span> <span class="n">option</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">4</span>
        <span class="c">#kwargs = {&#39;indexing&#39;: self._prop[&#39;indexing&#39;]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">9</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">10</span><span class="p">:</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span><span class="p">,</span> <span class="n">sz</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[:</span><span class="mi">9</span><span class="p">]]</span>
            <span class="c">#x, y, z, u, v, w = _check_xyzuvw(*args[:6])</span>
            <span class="c">#x, y, z = [asarray(a) for a in args[:3]] #_check_xyz(*args[:3])</span>
            <span class="c">#u, v, w = [asarray(a) for a in args[3:6]]</span>
            <span class="c">#sx, sy, sz = [asarray(a) for a in args[6:9]]</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">6</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">7</span><span class="p">:</span>
            <span class="n">u</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[:</span><span class="mi">2</span><span class="p">]]</span>
            <span class="k">if</span> <span class="n">rank</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span> <span class="c"># streamline(U,V,W,startx,starty,startz)</span>
                <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="n">nz</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
                <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span> <span class="o">=</span> <span class="n">ndgrid</span><span class="p">(</span><span class="n">seq</span><span class="p">(</span><span class="n">nx</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="n">seq</span><span class="p">(</span><span class="n">ny</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="n">seq</span><span class="p">(</span><span class="n">nz</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
                <span class="c">#w = asarray(args[2])</span>
                <span class="n">w</span><span class="p">,</span> <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span><span class="p">,</span> <span class="n">sz</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">6</span><span class="p">]]</span>
            <span class="k">else</span><span class="p">:</span> <span class="c"># streamline(X,Y,U,V,startx,starty)</span>
                <span class="n">x</span> <span class="o">=</span> <span class="n">u</span><span class="p">;</span>  <span class="n">y</span> <span class="o">=</span> <span class="n">v</span>
                <span class="c">#u, v = [asarray(a) for a in args[2:4]]</span>
                <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">6</span><span class="p">]]</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">4</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">5</span><span class="p">:</span> <span class="c"># streamline(U,V,startx,starty)</span>
            <span class="n">u</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[:</span><span class="mi">2</span><span class="p">]]</span>
            <span class="k">try</span><span class="p">:</span>
                <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
            <span class="k">except</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;u must be 2D, not </span><span class="si">%d</span><span class="s">D&quot;</span> <span class="o">%</span> <span class="n">rank</span><span class="p">(</span><span class="n">u</span><span class="p">))</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">ndgrid</span><span class="p">(</span><span class="n">seq</span><span class="p">(</span><span class="n">nx</span><span class="o">-</span><span class="mi">1</span><span class="p">),</span> <span class="n">seq</span><span class="p">(</span><span class="n">ny</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
            <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">]]</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">1</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">2</span><span class="p">:</span> <span class="c"># streamline(XYZ) or streamline(XY)</span>
            <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;Streams._parseargs: not implemented&#39;</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&#39;wrong number of arguments&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">7</span><span class="p">,</span><span class="mi">10</span><span class="p">):</span> <span class="c"># streamline(...,options)</span>
            <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span>
            <span class="n">options</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">options</span><span class="p">)</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamtube&#39;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;tubescale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;stepsize&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">options</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                    <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamtube&#39;</span><span class="p">:</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;n&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">maxverts</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">options</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamtube&#39;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;tubescale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">)</span>
                <span class="k">elif</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamribbon&#39;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ribbonwidth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;stepsize&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">options</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;options must be [stepsize[,maxverts]], not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                      <span class="n">options</span>
                <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamtube&#39;</span><span class="p">:</span>
                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;options must be [scale[,n]], not &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> <span class="n">options</span>
                <span class="k">elif</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;streamribbon&#39;</span><span class="p">:</span>
                    <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;options must be a [width], not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">options</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span>

<span class="c">##         if len(u.shape) == 3:</span>
<span class="c">##             assert shape(x) == shape(y) == shape(z) == \</span>
<span class="c">##                    shape(u) == shape(v) == shape(w), \</span>
<span class="c">##                    &quot;x, y, z, u, v, and z must be 3D arrays and of same shape&quot;</span>
<span class="c">##             assert shape(sx) == shape(sy) == shape(sz), \</span>
<span class="c">##                    &quot;startx, starty, and startz must all be of same shape&quot;</span>
<span class="c">##         else:</span>
<span class="c">##             assert shape(x) == shape(y) == shape(u) == shape(v), \</span>
<span class="c">##                    &quot;x, y, u, and v must be 2D arrays and of same shape&quot;</span>
<span class="c">##             assert shape(sx) == shape(sy), \</span>
<span class="c">##                    &quot;startx and starty must be of same shape&quot;</span>
            <span class="n">z</span> <span class="o">=</span> <span class="n">w</span> <span class="o">=</span> <span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">))</span>
            <span class="n">sz</span> <span class="o">=</span> <span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="p">(</span><span class="n">sx</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span><span class="p">,</span> <span class="n">sz</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">u</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="n">sx</span><span class="p">,</span> <span class="n">sy</span><span class="p">,</span> <span class="n">sz</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">z</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;udata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">u</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;vdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;wdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">w</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;startx&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sx</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;starty&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sy</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;startz&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">sz</span>
        <span class="k">if</span> <span class="n">rank</span><span class="p">(</span><span class="n">u</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">nx</span><span class="p">,</span> <span class="n">ny</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">shape</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">u</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofstreams&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">sx</span><span class="p">))</span>

</div>
<div class="viewcode-block" id="Volume"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Volume">[docs]</a><span class="k">class</span> <span class="nc">Volume</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about volume visualization techniques.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;slices&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;isovalue&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;clevels&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span> <span class="c"># default number of contour lines per plane</span>
        <span class="s">&#39;cvector&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;xdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;ydata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;zdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># grid components</span>
        <span class="s">&#39;vdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># data values at grid points</span>
        <span class="s">&#39;cdata&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># pseudocolor data</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span>
                      <span class="n">PlotProperties</span><span class="o">.</span><span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span>
                      <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Volume</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

<div class="viewcode-block" id="Volume.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Volume.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="n">PlotProperties</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;isovalue&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;isovalue&#39;</span><span class="p">],</span> <span class="s">&#39;isovalue&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;isovalue&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;isovalue&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;clevels&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">clevels</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">],</span> <span class="s">&#39;clevels&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="n">cvector</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">cvector</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">clevels</span> <span class="o">&gt;</span> <span class="nb">len</span><span class="p">(</span><span class="n">cvector</span><span class="p">):</span>
                <span class="n">clevels</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">cvector</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">clevels</span>

        <span class="k">if</span> <span class="s">&#39;cvector&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">],</span> <span class="s">&#39;cvector&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">])</span>
</div>
    <span class="k">def</span> <span class="nf">_parseargs</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">func</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;slice_&#39;</span><span class="p">,</span> <span class="s">&#39;contourslice&#39;</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs_slice_</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;isosurface&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_parseargs_isosurface</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_parseargs_slice_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="c"># this method also works for contourslice</span>
        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">7</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">8</span><span class="p">:</span>
            <span class="c"># slice_(X,Y,Z,V,Sx,Sy,Sz) or slice_(X,Y,Z,V,XI,YI,ZI)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyzv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">4</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="n">slices</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">4</span><span class="p">:</span><span class="mi">7</span><span class="p">]]</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">4</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">5</span><span class="p">:</span>
            <span class="c"># slice_(V,Sx,Sy,Sz) or slice_(V,XI,YI,ZI)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyzv</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">indexing</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">])</span>
            <span class="n">slices</span> <span class="o">=</span> <span class="p">[</span><span class="n">asarray</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">4</span><span class="p">]]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">5</span> <span class="ow">or</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">8</span><span class="p">:</span>
            <span class="n">func</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;function&#39;</span><span class="p">]</span>
            <span class="n">tmparg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;slice_&#39;</span><span class="p">:</span> <span class="c"># slice_(...,&#39;method&#39;)</span>
                <span class="n">intrp_methods</span> <span class="o">=</span> <span class="s">&#39;linear cubic nearest&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
                <span class="n">method</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">tmparg</span><span class="p">)</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="n">method</span> <span class="ow">in</span> <span class="n">interp_methods</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                        <span class="s">&#39;interpolation method must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                        <span class="p">(</span><span class="n">interp_methods</span><span class="p">,</span> <span class="n">method</span><span class="p">))</span>
                <span class="c">#self._prop[&#39;interpolationmethod&#39;] = method</span>
            <span class="k">elif</span> <span class="n">func</span> <span class="o">==</span> <span class="s">&#39;contourslice&#39;</span><span class="p">:</span> <span class="c"># contourslice(...,</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmparg</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span> <span class="ow">and</span> <span class="n">tmparg</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmparg</span>
                <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmparg</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">)):</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cvector&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmparg</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;clevels&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">tmparg</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">slices</span><span class="o">=</span><span class="n">slices</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_parseargs_isosurface</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;indexing&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">]}</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">5</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">6</span><span class="p">:</span> <span class="c"># isosurface(X,Y,Z,V,isovalue)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyzv</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">[:</span><span class="mi">4</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="n">isovalue</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">4</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">2</span> <span class="ow">and</span> <span class="n">nargs</span> <span class="o">&lt;=</span> <span class="mi">3</span><span class="p">:</span> <span class="c"># isosurface(V,isovalue)</span>
            <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span> <span class="o">=</span> <span class="n">_check_xyzv</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">indexing</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;indexing&#39;</span><span class="p">])</span>
            <span class="n">isovalue</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;Wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span><span class="mi">6</span><span class="p">):</span> <span class="c"># isosurface(...,COLORS)</span>
            <span class="n">cdata</span> <span class="o">=</span> <span class="n">asarray</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">assert</span> <span class="n">v</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="n">cdata</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> \
                   <span class="s">&quot;COLORS must have shape </span><span class="si">%s</span><span class="s"> (as V), not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                   <span class="p">(</span><span class="n">v</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="n">cdata</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">cdata</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_set_data</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">isovalue</span><span class="o">=</span><span class="n">isovalue</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">,</span> <span class="n">v</span><span class="p">,</span> <span class="n">slices</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">isovalue</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_set_lim</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">x</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ydata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">y</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">z</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;vdata&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span>
        <span class="k">if</span> <span class="n">slices</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;slices&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">slices</span>
        <span class="k">if</span> <span class="n">isovalue</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;isovalue&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">isovalue</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;dims&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">v</span><span class="o">.</span><span class="n">shape</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofpoints&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ravel</span><span class="p">(</span><span class="n">v</span><span class="p">))</span>

</div>
<div class="viewcode-block" id="Colorbar"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Colorbar">[docs]</a><span class="k">class</span> <span class="nc">Colorbar</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about color bars in color plots.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;cblocation&#39;</span><span class="p">:</span> <span class="s">&#39;EastOutside&#39;</span><span class="p">,</span>
        <span class="s">&#39;cbtitle&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;visible&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="n">_locations</span> <span class="o">=</span> <span class="s">&#39;North South East West NorthOutside SouthOutside &#39;</span> \
                 <span class="s">&#39;EastOutside WestOutside&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>

    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for color bar location&#39;</span><span class="p">,</span>
                      <span class="n">_locations</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Colorbar</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="Colorbar.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Colorbar.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">if</span> <span class="s">&#39;cblocation&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cblocation&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_locations</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cblocation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cblocation&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">print</span> <span class="s">&quot;colorbar location must be one of </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                      <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_locations</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cblocation&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;cbtitle&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cbtitle&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cbtitle&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;visible&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">])</span>
</div>
<div class="viewcode-block" id="Colorbar.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Colorbar.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">prm_name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Colorbar.reset"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Colorbar.reset">[docs]</a>    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>

</div></div>
<div class="viewcode-block" id="Light"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Light">[docs]</a><span class="k">class</span> <span class="nc">Light</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about light in a visualization.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;lightcolor&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
        <span class="s">&#39;lightpos&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span>
        <span class="s">&#39;lighttarget&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;intensity&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s">&#39;visible&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Light</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="Light.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Light.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">if</span> <span class="s">&#39;lightcolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">color</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;lightcolor&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">color</span><span class="p">,</span> <span class="s">&#39;lightcolor&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">))</span>
            <span class="n">_check_size</span><span class="p">(</span><span class="n">color</span><span class="p">,</span> <span class="s">&#39;lightcolor&#39;</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">3</span><span class="p">):</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">color</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="s">&#39;lightcolor&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;lightcolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">color</span>

        <span class="k">if</span> <span class="s">&#39;lightpos&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;lightpos&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;lightpos&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;lighttarget&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;lighttarget&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;lighttarget&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;itensity&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;itensity&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;itensity&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;visible&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">])</span>
</div>
<div class="viewcode-block" id="Light.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Light.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &#39;</span><span class="si">%s</span><span class="s">&#39;.&quot;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">name</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Light.reset"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Light.reset">[docs]</a>    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>

</div></div>
<div class="viewcode-block" id="Camera"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Camera">[docs]</a><span class="k">class</span> <span class="nc">Camera</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about the camera in a visualization.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;cammode&#39;</span><span class="p">:</span> <span class="s">&#39;auto&#39;</span><span class="p">,</span>
        <span class="s">&#39;camtarget&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;camva&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># view angle</span>
        <span class="s">&#39;azimuth&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;elevation&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;view&#39;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
        <span class="s">&#39;camup&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;camdolly&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;camroll&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># angle</span>
        <span class="s">&#39;camzoom&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
        <span class="s">&#39;campos&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;camproj&#39;</span><span class="p">:</span> <span class="s">&#39;orthographic&#39;</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="n">_modes</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="s">&#39;manual&#39;</span><span class="p">]</span>
    <span class="n">_camprojs</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;orthographic&#39;</span><span class="p">,</span> <span class="s">&#39;perspective&#39;</span><span class="p">]</span>

    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for the mode keyword&#39;</span><span class="p">,</span> <span class="n">_modes</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for the camproj keyword&#39;</span><span class="p">,</span> <span class="n">_camprojs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">axis</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Camera</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_ax</span> <span class="o">=</span> <span class="n">axis</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="Camera.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Camera.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">if</span> <span class="s">&#39;cammode&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cammode&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;cammode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cammode&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Camera.setp: cammode must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;cammode&#39;</span><span class="p">]))</span>

        <span class="k">if</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">view</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">view</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_set_default_view</span><span class="p">(</span><span class="n">view</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">view</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">view</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">view</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                    <span class="s">&quot;Camera.setp: view must be either [az,el], 2, or 3.&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;camproj&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;camproj&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_camprojs</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camproj&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;camproj&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;projection must one of </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_camprojs</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;camproj&#39;</span><span class="p">]))</span>

        <span class="k">for</span> <span class="n">prop</span> <span class="ow">in</span> <span class="s">&#39;camzoom camva camroll&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">prop</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">prop</span><span class="p">],</span> <span class="n">prop</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">prop</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">prop</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;azimuth&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">],</span> <span class="s">&#39;azimuth&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">])</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>

        <span class="k">if</span> <span class="s">&#39;elevation&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">],</span> <span class="s">&#39;elevation&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;elevation&#39;</span><span class="p">])</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;azimuth&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> <span class="c"># elevation is also != None</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camup&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">prop</span> <span class="ow">in</span> <span class="s">&#39;camtarget campos camup camdolly&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">prop</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">prop</span><span class="p">],</span> <span class="n">prop</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">))</span>
                <span class="n">_check_size</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">prop</span><span class="p">],</span> <span class="n">prop</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">prop</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">prop</span><span class="p">]</span>
</div>
<div class="viewcode-block" id="Camera.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Camera.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &#39;</span><span class="si">%s</span><span class="s">&#39;.&quot;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">name</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Camera.reset"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Camera.reset">[docs]</a>    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Reset camera to defaults.&quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
</div>
    <span class="k">def</span> <span class="nf">_set_default_view</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">view</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">view</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camtarget&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;center&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camup&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>

</div>
<div class="viewcode-block" id="Axis"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis">[docs]</a><span class="k">class</span> <span class="nc">Axis</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Information about the axis in curve, surface, and volume plots.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;plotitems&#39;</span><span class="p">:</span> <span class="p">[],</span>
        <span class="s">&#39;numberofitems&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="s">&#39;mode&#39;</span><span class="p">:</span> <span class="s">&#39;auto&#39;</span><span class="p">,</span>
        <span class="s">&#39;method&#39;</span><span class="p">:</span> <span class="s">&#39;normal&#39;</span><span class="p">,</span>
        <span class="s">&#39;direction&#39;</span><span class="p">:</span> <span class="s">&#39;xy&#39;</span><span class="p">,</span>
        <span class="s">&#39;hold&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;hidden&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
        <span class="s">&#39;box&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;grid&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>
        <span class="s">&#39;camera&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;cameramode&#39;</span><span class="p">:</span> <span class="s">&#39;auto&#39;</span><span class="p">,</span>
        <span class="s">&#39;lights&#39;</span><span class="p">:</span> <span class="p">[],</span>
        <span class="s">&#39;colorbar&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;colormap&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;caxis&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span>
        <span class="s">&#39;caxismode&#39;</span><span class="p">:</span> <span class="s">&#39;auto&#39;</span><span class="p">,</span>
        <span class="s">&#39;axiscolor&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;bgcolor&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="c"># background color</span>
        <span class="s">&#39;fgcolor&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="c"># foreground color</span>
        <span class="s">&#39;fontname&#39;</span><span class="p">:</span> <span class="s">&#39;Helvetica&#39;</span><span class="p">,</span>
        <span class="s">&#39;fontsize&#39;</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span>
        <span class="s">&#39;shading&#39;</span><span class="p">:</span> <span class="s">&#39;faceted&#39;</span><span class="p">,</span>
        <span class="s">&#39;scale&#39;</span><span class="p">:</span> <span class="s">&#39;linear&#39;</span><span class="p">,</span>
        <span class="s">&#39;xmin&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;xmax&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;ymin&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;ymax&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;zmin&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="s">&#39;zmax&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;xlim&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span>
        <span class="s">&#39;ylim&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span>
        <span class="s">&#39;zlim&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span>
        <span class="s">&#39;title&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;xlabel&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="s">&#39;ylabel&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span> <span class="s">&#39;zlabel&#39;</span><span class="p">:</span> <span class="s">&#39;&#39;</span><span class="p">,</span>
        <span class="s">&#39;center&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span>
        <span class="s">&#39;daspect&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">3</span><span class="p">,</span>
        <span class="s">&#39;daspectmode&#39;</span><span class="p">:</span> <span class="s">&#39;auto&#39;</span><span class="p">,</span>
        <span class="s">&#39;visible&#39;</span><span class="p">:</span>  <span class="bp">True</span><span class="p">,</span>
        <span class="s">&#39;viewport&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># viewport coords (list with 4 elm, backend specific)</span>
        <span class="s">&#39;ambientcolor&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;diffusecolor&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;speculartcolor&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>
        <span class="s">&#39;pth&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span> <span class="c"># this is the p-th axis in subplot(m,n,p)</span>
        <span class="s">&#39;colororder&#39;</span><span class="p">:</span> <span class="s">&#39;b g r c m y k&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">(),</span>
        <span class="s">&#39;curcolor&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="n">_directions</span> <span class="o">=</span> <span class="s">&quot;ij xy&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_methods</span> <span class="o">=</span> <span class="s">&quot;equal image square normal vis3d&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_modes</span> <span class="o">=</span> <span class="s">&quot;auto manual tight fill&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_ranges</span> <span class="o">=</span> <span class="s">&quot;xmin xmax ymin ymax zmin zmax&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_shadings</span> <span class="o">=</span> <span class="s">&quot;flat interp faceted&quot;</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
    <span class="n">_legend_locs</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;upper right&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s">&#39;upper left&#39;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
                    <span class="s">&#39;lower left&#39;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>  <span class="s">&#39;lower right&#39;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
                    <span class="s">&#39;center left&#39;</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span> <span class="s">&#39;center right&#39;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
                    <span class="s">&#39;lower center&#39;</span><span class="p">:</span> <span class="mi">8</span><span class="p">,</span> <span class="s">&#39;upper center&#39;</span><span class="p">:</span> <span class="mi">9</span><span class="p">,</span>
                    <span class="s">&#39;best&#39;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span> <span class="s">&#39;right&#39;</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span> <span class="s">&#39;center&#39;</span><span class="p">:</span> <span class="mi">10</span><span class="p">}</span>

    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for direction keyword&#39;</span><span class="p">,</span> <span class="n">_directions</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for method keyword&#39;</span><span class="p">,</span> <span class="n">_methods</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for mode keyword&#39;</span><span class="p">,</span> <span class="n">_modes</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for range keyword&#39;</span><span class="p">,</span> <span class="n">_ranges</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for shading keyword&#39;</span><span class="p">,</span> <span class="n">_shadings</span><span class="p">)</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for legend locations&#39;</span><span class="p">,</span>
                      <span class="nb">list</span><span class="p">(</span><span class="n">_legend_locs</span><span class="o">.</span><span class="n">keys</span><span class="p">()))</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Axis</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="c"># self was not available when _local_prop was defined:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camera&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Camera</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Colorbar</span><span class="p">()</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="Axis.dump"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.dump">[docs]</a>    <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Dump the parameters of this object.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="Axis.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">if</span> <span class="s">&#39;mode&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">mode</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;mode&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">mode</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;mode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">mode</span>
                <span class="k">if</span> <span class="n">mode</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="s">&#39;tight&#39;</span><span class="p">]:</span>
                    <span class="c"># clear the current axis ranges:</span>
                    <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ranges</span><span class="p">:</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">r</span><span class="p">]</span> <span class="o">=</span> <span class="bp">None</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: mode must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">,</span> <span class="n">mode</span><span class="p">))</span>

        <span class="k">if</span> <span class="s">&#39;method&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_methods</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: method must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_methods</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]))</span>

        <span class="k">if</span> <span class="s">&#39;direction&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;direction&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_directions</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;direction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;direction&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: direction must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_directions</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;direction&#39;</span><span class="p">]))</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="s">&#39;hold hidden box grid&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_toggle_state</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">])</span>
                <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;colorbar&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">],</span> <span class="n">Colorbar</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">visible</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;colormap&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colormap&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;colormap&#39;</span><span class="p">]</span> <span class="c"># backend dependent</span>

        <span class="k">if</span> <span class="s">&#39;caxis&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">ca</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ca</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">ca</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">ca</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&#39;cmin&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
                <span class="n">_check_type</span><span class="p">(</span><span class="n">ca</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s">&#39;cmax&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ca</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxismode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;manual&#39;</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.setp: caxis must be a two element vector&quot;</span> \
                                 <span class="s">&quot; [cmin,cmax], not &#39;</span><span class="si">%s</span><span class="s">&#39;.&quot;</span> \
                                 <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span><span class="n">ca</span><span class="p">))</span>

        <span class="k">if</span> <span class="s">&#39;caxismode&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">mode</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;caxismode&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;caxismode&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxismode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">mode</span>
                <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span>
                <span class="k">elif</span> <span class="n">mode</span> <span class="o">==</span> <span class="s">&#39;manual&#39;</span><span class="p">:</span>
                    <span class="k">if</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]:</span>
                        <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">]</span>
                        <span class="k">if</span> <span class="n">zmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">zmax</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span><span class="p">)</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;caxis&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: caxismode must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> \
                                 <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">,</span> <span class="n">mode</span><span class="p">))</span>

        <span class="k">if</span> <span class="s">&#39;shading&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;shading&#39;</span><span class="p">]</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_shadings</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;shading&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;shading&#39;</span><span class="p">]</span>
                <span class="c">#self._update_shading()</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: &#39;</span><span class="si">%s</span><span class="s">&#39; not a valid shading mode&quot;</span> \
                                 <span class="o">%</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;shading&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;light&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;light&#39;</span><span class="p">],</span> <span class="n">Light</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;lights&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;light&#39;</span><span class="p">])</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;Axis.setp: light must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">Light</span><span class="p">),</span> <span class="nb">type</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;light&#39;</span><span class="p">])))</span>

        <span class="c"># Set scale</span>
        <span class="k">if</span> <span class="s">&#39;log&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;x&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;logx&#39;</span>
            <span class="k">elif</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;y&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;logy&#39;</span>
            <span class="k">elif</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;xy&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;loglog&#39;</span>
            <span class="c"># Note: The only way to reset scale to linear after log is to</span>
            <span class="c"># use plot(args,log=None)</span>
            <span class="k">elif</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="bp">None</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;scale&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;linear&#39;</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ranges</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">)):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="s">&#39;xlim ylim zlim&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">_check_size</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="n">key</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="s">&#39;min&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="s">&#39;max&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;axis&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">axis</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;axis&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">axis</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">n</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">axis</span><span class="p">)</span>
                <span class="k">if</span> <span class="n">n</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span><span class="mi">6</span><span class="p">):</span>
                    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">n</span><span class="p">):</span>
                        <span class="n">_check_type</span><span class="p">(</span><span class="n">axis</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ranges</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="p">(</span><span class="nb">float</span><span class="p">,</span><span class="nb">int</span><span class="p">))</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_ranges</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span> <span class="o">=</span> <span class="n">axis</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
            <span class="k">elif</span> <span class="n">axis</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;on&#39;</span><span class="p">,</span> <span class="s">&#39;off&#39;</span><span class="p">]:</span> <span class="c">#, None, True, False]:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">axis</span><span class="p">)</span>
            <span class="k">elif</span> <span class="n">axis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_methods</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">axis</span>
            <span class="k">elif</span> <span class="n">axis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_modes</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;mode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">axis</span>
            <span class="k">elif</span> <span class="n">axis</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_directions</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;direction&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">axis</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;not a valid axis specification&quot;</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="s">&#39;title xlabel ylabel zlabel&#39;</span><span class="o">.</span><span class="n">split</span><span class="p">():</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;daspect&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">daspect</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">daspect</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">)):</span>
                <span class="n">daspect</span> <span class="o">=</span> <span class="p">[</span><span class="n">daspect</span><span class="p">]</span><span class="o">*</span><span class="mi">3</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">daspect</span><span class="p">,</span> <span class="s">&#39;daspect&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span>
            <span class="n">_check_size</span><span class="p">(</span><span class="n">daspect</span><span class="p">,</span> <span class="s">&#39;daspect&#39;</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="nb">float</span><span class="p">(</span><span class="n">elm</span><span class="p">)</span> <span class="k">for</span> <span class="n">elm</span> <span class="ow">in</span> <span class="n">daspect</span><span class="p">]</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspectmode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;manual&#39;</span>

        <span class="k">if</span> <span class="s">&#39;daspectmode&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspectmode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;daspectmode&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;fgcolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;fgcolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;fgcolor&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;bgcolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;bgcolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;bgcolor&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;visible&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_toggle_state</span><span class="p">(</span><span class="s">&#39;visible&#39;</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">])</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;visible&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;viewport&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">viewport</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;viewport&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">viewport</span><span class="p">,</span> <span class="s">&#39;viewport&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">))</span>
            <span class="n">_check_size</span><span class="p">(</span><span class="n">viewport</span><span class="p">,</span> <span class="s">&#39;viewport&#39;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
            <span class="c">#for i in range(4):</span>
            <span class="c">#    _check_type(viewport[i], &#39;viewport coor&#39;, (int,float))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;viewport&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">viewport</span>

        <span class="k">if</span> <span class="s">&#39;pth&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">pth</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;pth&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">pth</span><span class="p">,</span> <span class="s">&#39;pth&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;pth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pth</span>

        <span class="k">if</span> <span class="s">&#39;legend_loc&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;legend_loc&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend_loc&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="s">&#39;legend_fancybox&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;legend_fancybox&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend_fancybox&#39;</span><span class="p">]</span>

        <span class="c"># set properties for camera and colorbar:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camera&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="c"># update the axis:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Axis.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return parameter with name &#39;name&#39;.&quot;&quot;&quot;</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">name</span><span class="p">))</span>
</div>
<div class="viewcode-block" id="Axis.get_next_color"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.get_next_color">[docs]</a>    <span class="k">def</span> <span class="nf">get_next_color</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return the next color defined in the &#39;colororder&#39; property.&quot;&quot;&quot;</span>
        <span class="n">colors</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colororder&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curcolor&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="n">colors</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curcolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
        <span class="n">curcolor</span> <span class="o">=</span> <span class="n">colors</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curcolor&#39;</span><span class="p">]]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curcolor&#39;</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>
        <span class="k">return</span> <span class="n">curcolor</span>
</div>
<div class="viewcode-block" id="Axis.reset"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.reset">[docs]</a>    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Reset axis attributes to default values.&quot;&quot;&quot;</span>
        <span class="n">viewport</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;viewport&#39;</span><span class="p">]</span> <span class="c"># don&#39;t reset viewport coords</span>
        <span class="n">pth</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;pth&#39;</span><span class="p">]</span> <span class="c"># don&#39;t reset p-th axis information</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;viewport&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">viewport</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;pth&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">pth</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="c">#self._prop[&#39;camera&#39;].reset()</span>
        <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camera&#39;</span><span class="p">]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;camera&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Camera</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
        <span class="c">#for l in self._prop[&#39;lights&#39;]:</span>
        <span class="c">#    l.reset()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;lights&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="c">#self._prop[&#39;colorbar&#39;].reset()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;colorbar&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">Colorbar</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Axis.add"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.add">[docs]</a>    <span class="k">def</span> <span class="nf">add</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">items</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add all items in &#39;items&#39; to this axis.&quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;hold&#39;</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">items</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
            <span class="n">items</span> <span class="o">=</span> <span class="p">(</span><span class="n">items</span><span class="p">,)</span>
        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">items</span><span class="p">:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">PlotProperties</span><span class="p">):</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;item must be </span><span class="si">%s</span><span class="s"> (or a subclass), not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                 <span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">),</span> <span class="nb">type</span><span class="p">(</span><span class="n">item</span><span class="p">)))</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">update</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Axis.get_limits"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.get_limits">[docs]</a>    <span class="k">def</span> <span class="nf">get_limits</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return axis limits.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xlim&#39;</span><span class="p">]</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ylim&#39;</span><span class="p">]</span><span class="o">+</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">]</span>
</div>
<div class="viewcode-block" id="Axis.toggle"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.toggle">[docs]</a>    <span class="k">def</span> <span class="nf">toggle</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Toggle axis parameter with name &#39;name&#39;.&quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
</div>
<div class="viewcode-block" id="Axis.update"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Axis.update">[docs]</a>    <span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Update axis.&quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">])</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofitems&#39;</span><span class="p">]:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;numberofitems&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">])</span>
            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">]:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_update_limits</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;plotitems&#39;</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="ow">or</span> \
                   <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspectmode&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_update_daspect</span><span class="p">()</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_set_center</span><span class="p">()</span>
        <span class="n">p</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="s">&#39;xmin&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">p</span><span class="p">[</span><span class="s">&#39;xmax&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">or</span> \
           <span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="s">&#39;ymin&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">p</span><span class="p">[</span><span class="s">&#39;ymax&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">or</span> \
           <span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="s">&#39;zmin&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">p</span><span class="p">[</span><span class="s">&#39;zmax&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;mode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;manual&#39;</span>
        <span class="n">method</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">method</span> <span class="o">==</span> <span class="s">&#39;equal&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1.</span><span class="p">,</span><span class="mf">1.</span><span class="p">,</span><span class="mf">1.</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s">&#39;image&#39;</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mf">1.</span><span class="p">,</span><span class="mf">1.</span><span class="p">,</span><span class="mf">1.</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;mode&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;tight&#39;</span>
        <span class="k">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s">&#39;square&#39;</span><span class="p">:</span>
            <span class="c">#print &quot;axis method &#39;square&#39; not implemented yet&quot;</span>
            <span class="k">pass</span>
        <span class="k">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s">&#39;normal&#39;</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="ow">or</span> \
                   <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspectmode&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;auto&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_update_daspect</span><span class="p">()</span>
</div>
    <span class="k">def</span> <span class="nf">_toggle_state</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">state</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">state</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_set_center</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">center</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">3</span>
        <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_limits</span><span class="p">()</span>
        <span class="n">center</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">xmax</span> <span class="o">+</span> <span class="n">xmin</span><span class="p">)</span> <span class="o">/</span> <span class="mf">2.0</span>
        <span class="n">center</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">ymax</span> <span class="o">+</span> <span class="n">ymin</span><span class="p">)</span> <span class="o">/</span> <span class="mf">2.0</span>
        <span class="n">center</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">zmax</span> <span class="o">+</span> <span class="n">zmin</span><span class="p">)</span> <span class="o">/</span> <span class="mf">2.0</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;center&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">center</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_check_lim</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">l1</span><span class="p">,</span> <span class="n">l2</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return a tuple with the &quot;larger&quot; values of &#39;l1&#39; and &#39;l2&#39;.&quot;&quot;&quot;</span>
        <span class="n">lim</span> <span class="o">=</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span>
        <span class="k">if</span> <span class="n">l1</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">l2</span><span class="p">[</span><span class="mi">0</span><span class="p">]:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">l2</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">l1</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">l1</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">l2</span><span class="p">[</span><span class="mi">1</span><span class="p">]:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">l2</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">l1</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
        <span class="k">return</span> <span class="nb">tuple</span><span class="p">(</span><span class="n">lim</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_update_limits</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Update axis limits according to the PlotProperties given in &#39;item&#39;.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">xlim</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;xlim&#39;</span><span class="p">)</span>
        <span class="n">ylim</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;ylim&#39;</span><span class="p">)</span>
        <span class="n">zlim</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;zlim&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xlim&#39;</span><span class="p">]:</span>
            <span class="n">xlim</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_lim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xlim&#39;</span><span class="p">],</span> <span class="n">xlim</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ylim&#39;</span><span class="p">]:</span>
            <span class="n">ylim</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_lim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ylim&#39;</span><span class="p">],</span> <span class="n">ylim</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">]:</span>
            <span class="n">zlim</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_lim</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">],</span> <span class="n">zlim</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xlim&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">xlim</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ylim&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ylim</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zlim&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">zlim</span>

    <span class="k">def</span> <span class="nf">_update_daspect</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">lim</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_limits</span><span class="p">())</span>
        <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xmin&#39;</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;xmax&#39;</span><span class="p">]</span>
        <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ymin&#39;</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;ymax&#39;</span><span class="p">]</span>
        <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zmin&#39;</span><span class="p">],</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;zmax&#39;</span><span class="p">]</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="p">[</span><span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">]:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="n">xmin</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">xmax</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="p">[</span><span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">]:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">ymin</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">=</span> <span class="n">ymax</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="p">[</span><span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span><span class="p">]:</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">=</span> <span class="n">zmin</span>
            <span class="n">lim</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">=</span> <span class="n">zmax</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;method&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;normal&#39;</span><span class="p">:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">in</span> <span class="n">lim</span><span class="p">:</span> <span class="c"># limits are set</span>
                <span class="n">sx</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">lim</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">lim</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="n">sy</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">lim</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="o">-</span> <span class="n">lim</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
                <span class="n">sz</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">lim</span><span class="p">[</span><span class="mi">5</span><span class="p">]</span> <span class="o">-</span> <span class="n">lim</span><span class="p">[</span><span class="mi">4</span><span class="p">])</span>
                <span class="n">scale</span> <span class="o">=</span> <span class="nb">max</span><span class="p">([</span><span class="n">sx</span><span class="p">,</span><span class="n">sy</span><span class="p">,</span><span class="n">sz</span><span class="p">])</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="n">scale</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="n">scale</span> <span class="o">=</span> <span class="mi">1</span>
                <span class="k">if</span> <span class="n">sz</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
                    <span class="n">daspect</span> <span class="o">=</span> <span class="p">(</span><span class="n">sx</span><span class="o">/</span><span class="n">scale</span><span class="p">,</span> <span class="n">sy</span><span class="o">/</span><span class="n">scale</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">daspect</span> <span class="o">=</span> <span class="p">(</span><span class="n">sx</span><span class="o">/</span><span class="n">scale</span><span class="p">,</span> <span class="n">sy</span><span class="o">/</span><span class="n">scale</span><span class="p">,</span> <span class="n">sz</span><span class="o">/</span><span class="n">scale</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;daspect&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">daspect</span>

</div>
<div class="viewcode-block" id="Figure"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure">[docs]</a><span class="k">class</span> <span class="nc">Figure</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;Hold figure attributtes like axes, size, ....&quot;&quot;&quot;</span>

    <span class="n">_local_prop</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;axes&#39;</span><span class="p">:</span> <span class="bp">None</span><span class="p">,</span>     <span class="c"># dictionary of axis instances</span>
        <span class="s">&#39;curax&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>       <span class="c"># current axis</span>
        <span class="s">&#39;axshape&#39;</span><span class="p">:</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">),</span> <span class="c"># shape of axes</span>
        <span class="s">&#39;size&#39;</span><span class="p">:</span> <span class="p">[</span><span class="bp">None</span><span class="p">]</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span> <span class="c"># size of figure ([width, height])</span>
        <span class="s">&#39;number&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>      <span class="c"># this figures number</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_prop</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_prop</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">Figure</span><span class="o">.</span><span class="n">_local_prop</span><span class="p">)</span>
        <span class="c"># store a copy of the default values for use when figure is reset:</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">:</span> <span class="n">Axis</span><span class="p">()}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>

<div class="viewcode-block" id="Figure.dump"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure.dump">[docs]</a>    <span class="k">def</span> <span class="nf">dump</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Dump the contents of the figure (all axes).&quot;&quot;&quot;</span>
        <span class="n">s</span> <span class="o">=</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">Figure object:</span><span class="se">\n</span><span class="s">&#39;</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">s</span> <span class="o">+=</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">])</span> <span class="o">+</span> <span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span>
        <span class="k">for</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]:</span>
            <span class="n">s</span> <span class="o">+=</span> <span class="s">&#39;axis </span><span class="si">%d</span><span class="s">:</span><span class="se">\n</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">ax</span>
            <span class="c">#s += pprint.pformat(str(self._prop[&#39;axes&#39;][ax]))</span>
            <span class="n">s</span> <span class="o">+=</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="n">ax</span><span class="p">]</span><span class="o">.</span><span class="n">_prop</span><span class="p">)</span>
        <span class="k">return</span> <span class="n">s</span>
</div>
<div class="viewcode-block" id="Figure.gca"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure.gca">[docs]</a>    <span class="k">def</span> <span class="nf">gca</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return current axis.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]]</span>
</div>
<div class="viewcode-block" id="Figure.reset"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure.reset">[docs]</a>    <span class="k">def</span> <span class="nf">reset</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Reset figure attributes and backend to defaults.&quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_defaults</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">:</span> <span class="n">Axis</span><span class="p">()}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="Figure.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">if</span> <span class="s">&#39;axshape&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">shape</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;axshape&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="s">&#39;axshape&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">))</span>
            <span class="n">_check_size</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="s">&#39;axshape&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&#39;m&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="s">&#39;n&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axshape&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">shape</span>
            <span class="n">dx</span> <span class="o">=</span> <span class="mf">1.</span><span class="o">/</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>  <span class="n">dy</span> <span class="o">=</span> <span class="mf">1.</span><span class="o">/</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="n">last_x</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>  <span class="n">last_y</span> <span class="o">=</span> <span class="mi">1</span><span class="o">-</span><span class="n">dy</span>
            <span class="n">viewport_coords</span> <span class="o">=</span> <span class="p">[]</span>
            <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">seq</span><span class="p">(</span><span class="n">dy</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">dy</span><span class="p">):</span>
                <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">seq</span><span class="p">(</span><span class="n">dx</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="n">dx</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">backend</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">&#39;vtk&#39;</span><span class="p">):</span>
                        <span class="n">viewport_coords</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">last_x</span><span class="p">,</span><span class="n">last_y</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">last_y</span><span class="o">+</span><span class="n">dy</span><span class="p">))</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">viewport_coords</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">last_x</span><span class="p">,</span><span class="n">last_y</span><span class="p">,</span><span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">))</span>
                    <span class="n">last_x</span> <span class="o">=</span> <span class="n">x</span>
                <span class="n">last_x</span> <span class="o">=</span> <span class="mi">0</span>
                <span class="n">last_y</span> <span class="o">=</span> <span class="n">last_y</span> <span class="o">-</span> <span class="n">dy</span>

            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{}</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">iseq</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">viewport_coords</span><span class="p">)):</span>
                <span class="n">ax</span> <span class="o">=</span> <span class="n">Axis</span><span class="p">()</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">viewport</span><span class="o">=</span><span class="n">viewport_coords</span><span class="p">[</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="n">ax</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">pth</span><span class="o">=</span><span class="n">i</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;curax&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">curax</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span>
            <span class="c">#_check_type(curax, &#39;curax&#39;, int)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_set_current_axis</span><span class="p">(</span><span class="n">curax</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;size&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">size</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span>
            <span class="c"># size should be a list/tuple with two elements [width, height]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">size</span><span class="p">,</span> <span class="s">&#39;size&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">))</span>
            <span class="n">_check_size</span><span class="p">(</span><span class="n">size</span><span class="p">,</span> <span class="s">&#39;size&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;size&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">size</span>

        <span class="k">if</span> <span class="s">&#39;number&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">number</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;number&#39;</span><span class="p">]</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">number</span><span class="p">,</span> <span class="s">&#39;number&#39;</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;number&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">number</span>
</div>
<div class="viewcode-block" id="Figure.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.Figure.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">):</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="n">prm_name</span><span class="p">]</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&quot;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &#39;</span><span class="si">%s</span><span class="s">&#39;&quot;</span> <span class="o">%</span> \
                           <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">))</span>
</div>
    <span class="k">def</span> <span class="nf">_set_current_axis_old</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">):</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
            <span class="c"># check if it is inside axshape</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ax</span> <span class="c"># no good!</span>
        <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">Axis</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">:</span><span class="n">ax</span><span class="p">}</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axshape&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>

    <span class="k">def</span> <span class="nf">_set_current_axis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">):</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="nb">int</span><span class="p">)</span> <span class="ow">and</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ax</span>
        <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="n">Axis</span><span class="p">):</span>
            <span class="k">if</span> <span class="n">ax</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">values</span><span class="p">():</span>
                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
                    <span class="k">if</span> <span class="n">ax</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="n">i</span><span class="p">]:</span>
                        <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">i</span>
                        <span class="k">break</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">n</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span> <span class="o">+</span> <span class="mi">1</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;axes&#39;</span><span class="p">][</span><span class="n">n</span><span class="p">]</span> <span class="o">=</span> <span class="n">ax</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_prop</span><span class="p">[</span><span class="s">&#39;curax&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">n</span>

</div>
<div class="viewcode-block" id="BaseClass"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass">[docs]</a><span class="k">class</span> <span class="nc">BaseClass</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Subclasses implement different backends</span>
<span class="sd">    (GnuplotBackend for Gnuplot, for instance).</span>

<span class="sd">    This base class saves info about plotting to instances of class Figure,</span>
<span class="sd">    Line, and PlotItem.</span>

<span class="sd">    List of internal helper functions (for subclasses):</span>
<span class="sd">    ...</span>


<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">_matlab_like_cmds</span> <span class="o">=</span> <span class="p">[</span>
        <span class="s">&#39;autumn&#39;</span><span class="p">,</span> <span class="s">&#39;axes&#39;</span><span class="p">,</span> <span class="s">&#39;axis&#39;</span><span class="p">,</span> <span class="s">&#39;bone&#39;</span><span class="p">,</span> <span class="s">&#39;box&#39;</span><span class="p">,</span> <span class="s">&#39;brighten&#39;</span><span class="p">,</span>
        <span class="s">&#39;camdolly&#39;</span><span class="p">,</span> <span class="s">&#39;camlight&#39;</span><span class="p">,</span> <span class="s">&#39;camlookat&#39;</span><span class="p">,</span> <span class="s">&#39;campos&#39;</span><span class="p">,</span>
        <span class="s">&#39;camproj&#39;</span><span class="p">,</span> <span class="s">&#39;camroll&#39;</span><span class="p">,</span> <span class="s">&#39;camtarget&#39;</span><span class="p">,</span> <span class="s">&#39;camup&#39;</span><span class="p">,</span> <span class="s">&#39;camva&#39;</span><span class="p">,</span>
        <span class="s">&#39;camzoom&#39;</span><span class="p">,</span> <span class="s">&#39;caxis&#39;</span><span class="p">,</span> <span class="s">&#39;cla&#39;</span><span class="p">,</span> <span class="s">&#39;clabel&#39;</span><span class="p">,</span> <span class="s">&#39;clf&#39;</span><span class="p">,</span> <span class="s">&#39;close&#39;</span><span class="p">,</span>
        <span class="s">&#39;closefig&#39;</span><span class="p">,</span> <span class="s">&#39;closefigs&#39;</span><span class="p">,</span> <span class="s">&#39;coneplot&#39;</span><span class="p">,</span> <span class="s">&#39;colorbar&#39;</span><span class="p">,</span>
        <span class="s">&#39;colorcube&#39;</span><span class="p">,</span> <span class="s">&#39;colormap&#39;</span><span class="p">,</span> <span class="s">&#39;contour&#39;</span><span class="p">,</span> <span class="s">&#39;contour3&#39;</span><span class="p">,</span>
        <span class="s">&#39;contourf&#39;</span><span class="p">,</span> <span class="s">&#39;contourslice&#39;</span><span class="p">,</span> <span class="s">&#39;cool&#39;</span><span class="p">,</span> <span class="s">&#39;copper&#39;</span><span class="p">,</span>
        <span class="s">&#39;daspect&#39;</span><span class="p">,</span> <span class="s">&#39;figure&#39;</span><span class="p">,</span> <span class="s">&#39;fill&#39;</span><span class="p">,</span> <span class="s">&#39;fill3&#39;</span><span class="p">,</span> <span class="s">&#39;flag&#39;</span><span class="p">,</span> <span class="s">&#39;gca&#39;</span><span class="p">,</span>
        <span class="s">&#39;gcf&#39;</span><span class="p">,</span> <span class="s">&#39;get&#39;</span><span class="p">,</span> <span class="s">&#39;gray&#39;</span><span class="p">,</span> <span class="s">&#39;grid&#39;</span><span class="p">,</span> <span class="s">&#39;hardcopy&#39;</span><span class="p">,</span> <span class="s">&#39;hidden&#39;</span><span class="p">,</span>
        <span class="s">&#39;hold&#39;</span><span class="p">,</span> <span class="s">&#39;hot&#39;</span><span class="p">,</span> <span class="s">&#39;hsv&#39;</span><span class="p">,</span> <span class="s">&#39;ishold&#39;</span><span class="p">,</span> <span class="s">&#39;isocaps&#39;</span><span class="p">,</span>
        <span class="s">&#39;isosurface&#39;</span><span class="p">,</span> <span class="s">&#39;jet&#39;</span><span class="p">,</span> <span class="s">&#39;legend&#39;</span><span class="p">,</span> <span class="s">&#39;light&#39;</span><span class="p">,</span> <span class="s">&#39;lines&#39;</span><span class="p">,</span>
        <span class="s">&#39;loglog&#39;</span><span class="p">,</span> <span class="s">&#39;material&#39;</span><span class="p">,</span> <span class="s">&#39;mesh&#39;</span><span class="p">,</span> <span class="s">&#39;meshc&#39;</span><span class="p">,</span> <span class="s">&#39;openfig&#39;</span><span class="p">,</span>
        <span class="s">&#39;savefig&#39;</span><span class="p">,</span> <span class="s">&#39;pcolor&#39;</span><span class="p">,</span> <span class="s">&#39;pink&#39;</span><span class="p">,</span> <span class="s">&#39;plot&#39;</span><span class="p">,</span> <span class="s">&#39;plot3&#39;</span><span class="p">,</span> <span class="s">&#39;prism&#39;</span><span class="p">,</span>
        <span class="s">&#39;quiver&#39;</span><span class="p">,</span> <span class="s">&#39;quiver3&#39;</span><span class="p">,</span> <span class="s">&#39;reducevolum&#39;</span><span class="p">,</span> <span class="s">&#39;semilogx&#39;</span><span class="p">,</span>
        <span class="s">&#39;semilogy&#39;</span><span class="p">,</span> <span class="s">&#39;set&#39;</span><span class="p">,</span> <span class="s">&#39;shading&#39;</span><span class="p">,</span> <span class="s">&#39;show&#39;</span><span class="p">,</span> <span class="s">&#39;slice_&#39;</span><span class="p">,</span>
        <span class="s">&#39;spring&#39;</span><span class="p">,</span> <span class="s">&#39;streamline&#39;</span><span class="p">,</span> <span class="s">&#39;streamribbon&#39;</span><span class="p">,</span> <span class="s">&#39;streamslice&#39;</span><span class="p">,</span>
        <span class="s">&#39;streamtube&#39;</span><span class="p">,</span> <span class="s">&#39;savefig&#39;</span><span class="p">,</span> <span class="s">&#39;subplot&#39;</span><span class="p">,</span> <span class="s">&#39;subvolume&#39;</span><span class="p">,</span>
        <span class="s">&#39;summer&#39;</span><span class="p">,</span> <span class="s">&#39;surf&#39;</span><span class="p">,</span> <span class="s">&#39;surfc&#39;</span><span class="p">,</span> <span class="s">&#39;surfl&#39;</span><span class="p">,</span> <span class="s">&#39;title&#39;</span><span class="p">,</span> <span class="s">&#39;vga&#39;</span><span class="p">,</span> <span class="s">&#39;view&#39;</span><span class="p">,</span>
        <span class="s">&#39;white&#39;</span><span class="p">,</span> <span class="s">&#39;winter&#39;</span><span class="p">,</span> <span class="s">&#39;xlabel&#39;</span><span class="p">,</span> <span class="s">&#39;ylabel&#39;</span><span class="p">,</span> <span class="s">&#39;zlabel&#39;</span><span class="p">]</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;List of &quot;Matlab-like&quot; interface functions (for &#39;</span> <span class="o">+</span> \
                      <span class="s">&#39;the user)&#39;</span><span class="p">,</span> <span class="n">_matlab_like_cmds</span><span class="p">)</span>

    <span class="n">_local_attrs</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">&#39;curfig&#39;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>         <span class="c"># current figure</span>
        <span class="s">&#39;show&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>        <span class="c"># screenplot after each plot command</span>
        <span class="c">#&#39;changed&#39;: False,    # sync state</span>
        <span class="s">&#39;interactive&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span> <span class="c"># update backend after each change</span>
        <span class="s">&#39;color&#39;</span><span class="p">:</span> <span class="bp">False</span><span class="p">,</span>      <span class="c"># hardcopy with color?</span>
        <span class="p">}</span>
    <span class="n">_update_from_config_file</span><span class="p">(</span><span class="n">_local_attrs</span><span class="p">)</span>  <span class="c"># get defaults from scitools.cfg</span>
    <span class="n">__doc__</span> <span class="o">+=</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Keywords for the setp method&#39;</span><span class="p">,</span> <span class="n">_local_attrs</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>

    <span class="c"># Dictionary of functions testing legal types</span>
    <span class="n">_attrs_type</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;curfig&#39;</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">)),</span>
                   <span class="s">&#39;show&#39;</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">bool</span><span class="p">)),</span>
                   <span class="s">&#39;interactive&#39;</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,(</span><span class="nb">bool</span><span class="p">)),</span>
                   <span class="c">#&#39;changed&#39;: lambda arg: isinstance(arg, (bool)),</span>
                   <span class="s">&#39;color&#39;</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">arg</span><span class="p">:</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,(</span><span class="nb">bool</span><span class="p">))</span>
                   <span class="p">}</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">BaseClass</span><span class="o">.</span><span class="n">init</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>

<div class="viewcode-block" id="BaseClass.init"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.init">[docs]</a>    <span class="k">def</span> <span class="nf">init</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Initialize internal data structures.&quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_g</span> <span class="o">=</span> <span class="bp">None</span>  <span class="c"># Pointer to the backend for manual labour.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">:</span> <span class="n">Figure</span><span class="p">()}</span>  <span class="c"># dictionary of figure instances</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">BaseClass</span><span class="o">.</span><span class="n">_local_attrs</span><span class="p">)</span>
</div>
    <span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">pprint</span><span class="o">.</span><span class="n">pformat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">)</span>

<div class="viewcode-block" id="BaseClass.setp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.setp">[docs]</a>    <span class="k">def</span> <span class="nf">setp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Set object properties or attributes in this backend instance.</span>

<span class="sd">        Calling::</span>

<span class="sd">            setp([obj,] prop1=value1, prop2=value2, ...)</span>

<span class="sd">        will set the attributes as given in this backend instance. If the</span>
<span class="sd">        optional positional argument obj is a given object with a set method</span>
<span class="sd">        (like Figure, Axis, and PlotProperties objects), the (relevant)</span>
<span class="sd">        properties and values are also set in this object. This also works on</span>
<span class="sd">        a list with objects.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">arg</span> <span class="o">=</span> <span class="p">(</span><span class="n">arg</span><span class="p">,)</span>
            <span class="k">for</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">arg</span><span class="p">:</span>
                <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s">&#39;setp&#39;</span><span class="p">):</span>
                    <span class="n">obj</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="s">&#39;savefig&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>  <span class="c"># synonym: hardcopy</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;hardcopy&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;savefig&#39;</span><span class="p">]</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">value</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
            <span class="k">if</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">:</span>  <span class="c"># legal key?</span>
                <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attrs_type</span><span class="p">[</span><span class="n">key</span><span class="p">](</span><span class="n">value</span><span class="p">):</span>  <span class="c"># legal type?</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span> <span class="o">=</span> <span class="n">value</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span>
                        <span class="s">&#39;BaseClass.setp: keyword &quot;</span><span class="si">%s</span><span class="s">&quot; </span><span class="si">%s</span><span class="s"> is illegal.&#39;</span> <span class="o">%</span> \
                        <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">key</span><span class="p">)))</span>

        <span class="k">if</span> <span class="s">&#39;hardcopy&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">hardcopy</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;hardcopy&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="s">&#39;material&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">material</span><span class="p">(</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;material&#39;</span><span class="p">])</span>

        <span class="c"># subclasses should extend the doc string like this:</span>
        <span class="c">#set.__doc__ += docadd(&#39;Keywords for the setp method&#39;,</span>
        <span class="c">#                      BaseClass._local_attrs.keys(),</span>
        <span class="c">#                      SomeSubClass._local_attrs.keys())</span>
</div>
<div class="viewcode-block" id="BaseClass.getp"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.getp">[docs]</a>    <span class="k">def</span> <span class="nf">getp</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Get object properties or an attribute in this backend instance.</span>

<span class="sd">        Calling::</span>

<span class="sd">            getp(&#39;name&#39;)</span>

<span class="sd">        returns the attribute with name &#39;name&#39; in this backend instance.</span>

<span class="sd">        Calling::</span>

<span class="sd">            getp(obj, &#39;name&#39;)</span>

<span class="sd">        returns the property with name &#39;name&#39; of the object given in obj. This</span>
<span class="sd">        object must have a get method (like Figure, Axis, or PlotProperties</span>
<span class="sd">        objects).</span>

<span class="sd">        Calling::</span>

<span class="sd">            getp(obj)</span>

<span class="sd">        displays all property names and values for the object given in obj.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&#39;getp&#39;</span><span class="p">):</span>
                <span class="n">obj</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                    <span class="k">print</span> <span class="n">obj</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">return</span> <span class="n">obj</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">prm_name</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="k">try</span><span class="p">:</span>
                    <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="n">prm_name</span><span class="p">]</span>
                <span class="k">except</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">KeyError</span><span class="p">(</span><span class="s">&#39;</span><span class="si">%s</span><span class="s">.getp: no parameter with name &quot;</span><span class="si">%s</span><span class="s">&quot;&#39;</span> <span class="o">%</span> \
                                   <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">,</span> <span class="n">prm_name</span><span class="p">))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;getp: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="c"># subclasses should extend the doc string like this:</span>
        <span class="c">#getp.__doc__ += docadd(&#39;Keywords for the getp method&#39;,</span>
        <span class="c">#                       BaseClass._local_attrs.keys(),</span>
        <span class="c">#                       SomeSubClass._local_attrs.keys())</span>

    <span class="c">#def __getitem__(self, name):  self.getp(name)</span>

    <span class="c">#def __setitem__(self, name, value):  self.setp({name:value})</span>

</div>
    <span class="k">def</span> <span class="nf">_replot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Update backend after change in data.</span>
<span class="sd">        This is a key routine and must be implemented in the backend.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;_replot not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>

    <span class="k">def</span> <span class="nf">_check_args</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return the current axis, the argument list args, and the number of</span>
<span class="sd">        arguments in args. If the first argument in args is an Axis instance,</span>
<span class="sd">        this will be returned instead of the current axis. The Axis instancce</span>
<span class="sd">        is then removed from the argument list and the number of arguments</span>
<span class="sd">        is decremented by one.&quot;&quot;&quot;</span>
        <span class="n">ax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">Axis</span><span class="p">):</span>
            <span class="n">ax</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>  <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:];</span>  <span class="n">nargs</span> <span class="o">-=</span> <span class="mi">1</span>
        <span class="k">return</span> <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span>

    <span class="k">def</span> <span class="nf">_cmpPlotProperties</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Sort cmp function for PlotProperties.&quot;&quot;&quot;</span>
        <span class="n">plotorder</span> <span class="o">=</span> <span class="p">[</span><span class="n">Volume</span><span class="p">,</span> <span class="n">Streams</span><span class="p">,</span> <span class="n">Surface</span><span class="p">,</span> <span class="n">Contours</span><span class="p">,</span>
                     <span class="n">VelocityVectors</span><span class="p">,</span> <span class="n">Bars</span><span class="p">,</span> <span class="n">Line</span><span class="p">]</span>
        <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">PlotProperties</span><span class="p">)</span>
        <span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">b</span><span class="p">,</span> <span class="n">PlotProperties</span><span class="p">)</span>
        <span class="k">assert</span> <span class="nb">len</span><span class="p">(</span><span class="n">PlotProperties</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__subclasses__</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">))</span> <span class="o">==</span>\
               <span class="nb">len</span><span class="p">(</span><span class="n">plotorder</span><span class="p">)</span>  <span class="c"># check all subclasses is in plotorder</span>
        <span class="k">return</span> <span class="nb">cmp</span><span class="p">(</span><span class="n">plotorder</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">a</span><span class="o">.</span><span class="n">__class__</span><span class="p">),</span><span class="n">plotorder</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">b</span><span class="o">.</span><span class="n">__class__</span><span class="p">))</span>

<div class="viewcode-block" id="BaseClass.gcf"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.gcf">[docs]</a>    <span class="k">def</span> <span class="nf">gcf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return current figure.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">]]</span>
</div>
<div class="viewcode-block" id="BaseClass.gca"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.gca">[docs]</a>    <span class="k">def</span> <span class="nf">gca</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Return the current axis in the current figure.&quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.axes"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.axes">[docs]</a>    <span class="k">def</span> <span class="nf">axes</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Create axes in specified positions.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axes()</span>

<span class="sd">        returns a default Axis instance.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axes(ax)</span>

<span class="sd">        sets the axis in the Axis instance ax as the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axes(viewport=RECT)</span>

<span class="sd">        returns a axis at the position given in RECT. RECT is normally a list</span>
<span class="sd">        [left,bottom,width,height], where the four parameters (values between</span>
<span class="sd">        0 and 1) specifies the location and size of the axis box ((0,0) is the</span>
<span class="sd">        lower-left corner and (1,1) is the upper-right corner). However, this</span>
<span class="sd">        is backend-dependent.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">a</span> <span class="o">=</span> <span class="n">Axis</span><span class="p">()</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
                <span class="n">a</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">curax</span><span class="o">=</span><span class="n">a</span><span class="p">)</span>
            <span class="k">return</span> <span class="n">a</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">_check_type</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&#39;ax&#39;</span><span class="p">,</span> <span class="n">Axis</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">curax</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
            <span class="c">#raise NotImplementedError(&#39;not yet implemented&#39;)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="k">pass</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;axes: wrong number of arguments&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.subplot"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.subplot">[docs]</a>    <span class="k">def</span> <span class="nf">subplot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Create axes in tiled positions.</span>

<span class="sd">        Calling::</span>

<span class="sd">            subplot(m,n,p)</span>

<span class="sd">        splits the Figure window into m rows and n columns of small axes. The</span>
<span class="sd">        p-th axis is then selected for the current plot and the Axis object</span>
<span class="sd">        is returned.</span>

<span class="sd">        Calling::</span>

<span class="sd">            subplot(mnp)</span>

<span class="sd">        is the same as calling subplot(m,n,p) as long as m&lt;=n&lt;=p&lt;10.</span>

<span class="sd">        Example:</span>

<span class="sd">        &gt;&gt;&gt; x = linspace(-5,5,101)</span>
<span class="sd">        &gt;&gt;&gt; subplot(2,1,1)</span>
<span class="sd">        &gt;&gt;&gt; plot(x,x-cos(x**2))</span>
<span class="sd">        &gt;&gt;&gt; x = logspace(-1,2)</span>
<span class="sd">        &gt;&gt;&gt; subplot(2,1,2)</span>
<span class="sd">        &gt;&gt;&gt; loglog(x,exp(x),&#39;b-s&#39;)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">fig</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">sp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sp</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">3</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;subplot: &#39;</span><span class="si">%s</span><span class="s">&#39; is not a valid subplot&quot;</span> <span class="o">%</span> <span class="n">sp</span><span class="p">)</span>
            <span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> <span class="k">for</span> <span class="n">a</span> <span class="ow">in</span> <span class="n">sp</span><span class="p">]</span>
            <span class="n">nargs</span> <span class="o">=</span> <span class="mi">3</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">m</span><span class="p">,</span> <span class="n">n</span><span class="p">,</span> <span class="n">p</span> <span class="o">=</span> <span class="n">args</span>
            <span class="k">if</span> <span class="n">fig</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;axshape&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="p">(</span><span class="n">m</span><span class="p">,</span><span class="n">n</span><span class="p">):</span>
                <span class="n">fig</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">curax</span><span class="o">=</span><span class="n">p</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">fig</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">axshape</span><span class="o">=</span><span class="p">(</span><span class="n">m</span><span class="p">,</span><span class="n">n</span><span class="p">),</span> <span class="n">curax</span><span class="o">=</span><span class="n">p</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;subplot: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.daspect"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.daspect">[docs]</a>    <span class="k">def</span> <span class="nf">daspect</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Change the data aspect ratio.</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect([x,y,z])</span>

<span class="sd">        sets the data aspect ratio for the x, y, and z axis (e.g.,</span>
<span class="sd">        daspect([1,2,4]) means that one unit in x direction is equal in</span>
<span class="sd">        length to two units in y direction and four units in z direction).</span>
<span class="sd">        For example, daspect([r,1,1]) makes the physical size of the</span>
<span class="sd">        y axis in the plot r times the x axis.</span>

<span class="sd">        The size of the axes must be explicitly in order for the</span>
<span class="sd">        daspect command to work properly.</span>
<span class="sd">        Note that setting the aspect ratio is not supported by all backends.</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect()</span>

<span class="sd">        returns the data aspect ratio for the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect(mode)</span>

<span class="sd">        sets the data aspect ratio mode, where mode can be &#39;auto&#39;, &#39;equal&#39;,</span>
<span class="sd">        or &#39;manual&#39;. By specifying the mode to &#39;auto&#39; (default), the data</span>
<span class="sd">        aspect ratio will be automatically computed so that each axis spans</span>
<span class="sd">        the available space in the figure window. In the &#39;manual&#39; mode</span>
<span class="sd">        the user sets the aspect ratio, while &#39;equal&#39; means that the</span>
<span class="sd">        the same units are used in both axes (for example, if the x axis</span>
<span class="sd">        goes from 0 to 10 and the y axis from 0 to 1, and we want the</span>
<span class="sd">        x axis ten times as long as the y axis, the manual aspect ratio</span>
<span class="sd">        er 0.1, and &#39;equal&#39; will automatically set the ratio to 0.1).</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect(&#39;mode&#39;)</span>

<span class="sd">        returns the data aspect ratio mode.</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect(r)</span>

<span class="sd">        sets the data aspect ratio to r. This is for backends that do not</span>
<span class="sd">        support setting individual aspect ratios for the x, y, and z axis</span>
<span class="sd">        (like the Gnuplot backend). If the backend do support individual</span>
<span class="sd">        aspect ratios, the aspect ratio is set to r for all three axes.</span>

<span class="sd">        Calling::</span>

<span class="sd">            daspect(ax, ...)</span>

<span class="sd">        uses the the Axis object ax instead of the current axis.</span>

<span class="sd">        &gt;&gt;&gt; surf(peaks(21))</span>
<span class="sd">        &lt;scitools.easyviz.common.Surface object at 0xb7d7950c&gt;</span>
<span class="sd">        &gt;&gt;&gt; daspect()</span>
<span class="sd">        (1.0, 1.0, 0.71549553759291729)</span>
<span class="sd">        &gt;&gt;&gt; figure()</span>
<span class="sd">        &gt;&gt;&gt; surf(peaks(21))</span>
<span class="sd">        &lt;scitools.easyviz.common.Surface object at 0xb58ff70c&gt;</span>
<span class="sd">        &gt;&gt;&gt; daspect([1,1,1])</span>
<span class="sd">        &gt;&gt;&gt;</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;daspect&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">arg</span> <span class="o">==</span> <span class="s">&#39;mode&#39;</span><span class="p">:</span>
                    <span class="k">return</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;daspectmode&#39;</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">daspcetmode</span><span class="o">=</span><span class="n">arg</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">daspect</span><span class="o">=</span><span class="n">arg</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;daspect: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.openfig"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.openfig">[docs]</a>    <span class="k">def</span> <span class="nf">openfig</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;figspickle.txt&#39;</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Load figures saved in a file (with the given filename).</span>
<span class="sd">        The format of this file is currently standard Python pickle format.</span>
<span class="sd">        All figures in a previous session were dumped to the file, and</span>
<span class="sd">        all these figures are by this method reloaded and added to the</span>
<span class="sd">        current set of figures.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="c"># in savefig, self._figs was pickled as one object</span>
        <span class="n">handle</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&#39;r&#39;</span><span class="p">)</span>
        <span class="n">filefigs</span> <span class="o">=</span> <span class="n">pickle</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">handle</span><span class="p">)</span>
        <span class="n">handle</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

        <span class="c"># check that filefigs is a dict of Figure instances:</span>
        <span class="n">fail</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">filefigs</span><span class="p">,</span> <span class="nb">dict</span><span class="p">):</span>
            <span class="n">fail</span> <span class="o">=</span> <span class="bp">False</span>
            <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">filefigs</span><span class="p">:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Figure</span><span class="p">):</span>
                    <span class="n">fail</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="k">if</span> <span class="n">fail</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&quot;Import error. Cannot retrieve figures from filename </span><span class="si">%s</span><span class="s"> .&quot;</span> <span class="o">%</span> <span class="n">filename</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">filefigs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.savefig"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.savefig">[docs]</a>    <span class="k">def</span> <span class="nf">savefig</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s">&#39;figspickle.txt&#39;</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Save all current figures to a file (with the given filename).</span>
<span class="sd">        The file has standard Python pickle format (dict of Figure</span>
<span class="sd">        instances). The figures can later be reloaded by the openfig</span>
<span class="sd">        method.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">handle</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s">&#39;w&#39;</span><span class="p">)</span>
        <span class="n">pickle</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">,</span> <span class="n">handle</span><span class="p">)</span>
        <span class="n">handle</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.hardcopy"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.hardcopy">[docs]</a>    <span class="k">def</span> <span class="nf">hardcopy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Save a hardcopy of the current figure to file (with the given</span>
<span class="sd">        filename). The file format (image type) is determined from the</span>
<span class="sd">        extension of the filename. If any changes have been made by working</span>
<span class="sd">        directly on the backend instance, set the keyword argument replot</span>
<span class="sd">        to False to stop Easyviz from replotting the current figure and</span>
<span class="sd">        destroying those changes.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="c"># must be implemented in subclass</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;hardcopy not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.hold"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.hold">[docs]</a>    <span class="k">def</span> <span class="nf">hold</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Change the hold state of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hold(&#39;on&#39;)</span>

<span class="sd">        makes every subsequent plotting commands be added to the current plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hold(&#39;off&#39;)</span>

<span class="sd">        clears the previous plot before the new plot is drawn. This is the</span>
<span class="sd">        default behavior.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hold()</span>

<span class="sd">        toggles the hold state in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hold(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>

<span class="sd">        Note that one can use hold(True) and hold(False) instead of</span>
<span class="sd">        hold(&#39;on&#39;) and hold(&#39;off&#39;), respectively.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">hold</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">toggle</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span>
            <span class="k">print</span> <span class="s">&quot;hold state is </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&#39;hold: wrong number of arguments&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.ishold"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.ishold">[docs]</a>    <span class="k">def</span> <span class="nf">ishold</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Return the hold state (True if hold is on, and False if it is off).</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.figure"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.figure">[docs]</a>    <span class="k">def</span> <span class="nf">figure</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Create a new figure or switch between figures and return Figure object.</span>
<span class="sd">        num is the figure number of the new or existing figure.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">try</span><span class="p">:</span>
            <span class="n">num</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">num</span><span class="p">)</span>
        <span class="k">except</span><span class="p">:</span>
            <span class="c"># print str(num),&#39; is not an integer&#39;</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> <span class="c"># No figures left</span>
                <span class="n">num</span> <span class="o">=</span> <span class="mi">1</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">num</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span><span class="o">+</span><span class="mi">1</span>
                <span class="c">#print &quot;Active figure is %d.&quot; % num</span>

        <span class="k">if</span> <span class="ow">not</span> <span class="n">num</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">:</span>
            <span class="c"># Points to class Figure or other convenient function</span>
            <span class="c"># In gnuplot backend this should instantiate a new pipe instead</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;number&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">num</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="n">num</span><span class="p">]</span> <span class="o">=</span> <span class="n">Figure</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">num</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="n">num</span><span class="p">]</span>
</div>
<div class="viewcode-block" id="BaseClass.clf"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.clf">[docs]</a>    <span class="k">def</span> <span class="nf">clf</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Clear the current figure.&quot;&quot;&quot;</span>
        <span class="c">#self.gcf().reset()</span>
        <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">]]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">])</span>
</div>
<div class="viewcode-block" id="BaseClass.cla"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.cla">[docs]</a>    <span class="k">def</span> <span class="nf">cla</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Clear the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            cla()</span>

<span class="sd">        clears the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            cla(ax)</span>

<span class="sd">        clears the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">reset</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.axis"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.axis">[docs]</a>    <span class="k">def</span> <span class="nf">axis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Choose the axis limits and appearance.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis([xmin, xmax, ymin, ymax[, zmin, zmax]])</span>

<span class="sd">        sets the limits on the x-, y-, and z-axes in the current plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(xmin, xmax, ymin, ymax[, zmin, zmax])</span>

<span class="sd">        gives the same result as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis()</span>

<span class="sd">        returns the limits on the x-, y-, and z-axes for the current plot.</span>
<span class="sd">        If the view in the current plot is a 2D view, only the limits on the</span>
<span class="sd">        x- and y-axis are returned.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(mode)</span>

<span class="sd">        sets axis scaling to mode, where mode can be</span>

<span class="sd">          * &#39;auto&#39;   - autoscaling is used</span>
<span class="sd">          * &#39;manual&#39; - freeze the scaling at the current limits</span>
<span class="sd">          * &#39;tight&#39;  - sets the axis limits to the range of the data</span>
<span class="sd">          * &#39;fill&#39;   - has currently no affect</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(method)</span>

<span class="sd">        sets the appearance of the current axis as specified by method.</span>
<span class="sd">        %s</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(direction)</span>

<span class="sd">        sets the direction of the increasing values on the axes.</span>

<span class="sd">          * &#39;ij&#39; - reverse y-axis</span>
<span class="sd">          * &#39;xy&#39; - restore y-axis</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(&#39;off&#39;)</span>

<span class="sd">        turns off the visibility of the axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(&#39;on&#39;)</span>

<span class="sd">        turns the visibility of the axis back on.</span>

<span class="sd">        Calling::</span>

<span class="sd">            axis(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">kwargs</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">get_limits</span><span class="p">()</span>
            <span class="k">def</span> <span class="nf">get_lim</span><span class="p">(</span><span class="n">amin</span><span class="p">,</span> <span class="n">amax</span><span class="p">,</span> <span class="n">n1</span><span class="p">,</span> <span class="n">n2</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="n">n1</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span> <span class="ow">and</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="n">n2</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
                    <span class="k">return</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="n">n1</span><span class="p">),</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="n">n2</span><span class="p">)</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">return</span> <span class="n">amin</span><span class="p">,</span> <span class="n">amax</span>
            <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span> <span class="o">=</span> <span class="n">get_lim</span><span class="p">(</span><span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="s">&#39;xmin&#39;</span><span class="p">,</span> <span class="s">&#39;xmax&#39;</span><span class="p">)</span>
            <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span> <span class="o">=</span> <span class="n">get_lim</span><span class="p">(</span><span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="s">&#39;ymin&#39;</span><span class="p">,</span> <span class="s">&#39;ymax&#39;</span><span class="p">)</span>
            <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="n">get_lim</span><span class="p">(</span><span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span><span class="p">,</span> <span class="s">&#39;zmin&#39;</span><span class="p">,</span> <span class="s">&#39;zmax&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;view&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="k">return</span> <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span>
            <span class="k">return</span> <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span><span class="p">,</span> <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span>

        <span class="n">limits</span> <span class="o">=</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_ranges</span>

        <span class="c"># Allow both axis(xmin,xmax,ymin,ymax[,zmin,zmax]) and</span>
        <span class="c"># axis([xmin,xmax,ymin,ymax[,zmin,zmax]])</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>  <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_modes</span><span class="p">:</span>
                    <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">mode</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;on&#39;</span><span class="p">,</span> <span class="s">&#39;off&#39;</span><span class="p">]:</span>
                    <span class="n">state</span> <span class="o">=</span> <span class="n">_toggle_state</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                    <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">visible</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
                <span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_methods</span><span class="p">:</span>
                    <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">method</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
                <span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_directions</span><span class="p">:</span>
                    <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">direction</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="n">kwargs_</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="c"># first treat positional arguments:</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">4</span><span class="p">,</span><span class="mi">6</span><span class="p">):</span>
            <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nargs</span><span class="p">):</span>
                <span class="n">kwargs_</span><span class="p">[</span><span class="n">limits</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">]</span>
        <span class="c"># allow keyword arguments:</span>
        <span class="k">for</span> <span class="n">kw</span> <span class="ow">in</span> <span class="n">limits</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">kw</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">kwargs_</span><span class="p">[</span><span class="n">kw</span><span class="p">]</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">kw</span><span class="p">]</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs_</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
    <span class="n">axis</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">=</span> <span class="n">axis</span><span class="o">.</span><span class="n">__doc__</span> <span class="o">%</span> <span class="n">docadd</span><span class="p">(</span><span class="s">&#39;Legal values for method are&#39;</span><span class="p">,</span>
                                         <span class="n">Axis</span><span class="o">.</span><span class="n">_methods</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>

<div class="viewcode-block" id="BaseClass.xlim"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.xlim">[docs]</a>    <span class="k">def</span> <span class="nf">xlim</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Set or get limits on x axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xlim([xmin,xmax])</span>

<span class="sd">        sets the x limits on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xlim(xmin,xmax)</span>

<span class="sd">        gives the same results as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xmin, xmax = xlim()</span>

<span class="sd">        returns the x limits for the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xlim(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">xmin</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;xmin&#39;</span><span class="p">)</span>
            <span class="n">xmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;xmax&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">xmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">xmax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;xlim&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">xmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">xmax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">,</span><span class="n">NumPyArray</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">xmin</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">xmax</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">xmin</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">xmax</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&#39;xlim: wrong number of arguments.&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.ylim"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.ylim">[docs]</a>    <span class="k">def</span> <span class="nf">ylim</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Set or get limits on y axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ylim([ymin,ymax])</span>

<span class="sd">        sets the y limits on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ylim(ymin,ymax)</span>

<span class="sd">        gives the same results as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ymin, ymax = ylim()</span>

<span class="sd">        returns the y limits for the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ylim(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">ymin</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;ymin&#39;</span><span class="p">)</span>
            <span class="n">ymax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;ymax&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">ymin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">ymax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;ylim&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">ymin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">ymax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">,</span><span class="n">NumPyArray</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">ymin</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ymax</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">ymin</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ymax</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&#39;ylim: wrong number of arguments.&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.zlim"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.zlim">[docs]</a>    <span class="k">def</span> <span class="nf">zlim</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Set or get limits on z axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zlim([zmin,zmax])</span>

<span class="sd">        sets the z limits on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zlim(zmin,zmax)</span>

<span class="sd">        gives the same results as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zmin, zmax = zlim()</span>

<span class="sd">        returns the z limits for the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zlim(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">zmin</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;zmin&#39;</span><span class="p">)</span>
            <span class="n">zmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;zmax&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">zmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">zmax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;zlim&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">zmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">zmax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="k">return</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">]</span>
            <span class="k">return</span> <span class="n">zmin</span><span class="p">,</span> <span class="n">zmax</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">arg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span><span class="nb">tuple</span><span class="p">,</span><span class="n">NumPyArray</span><span class="p">))</span> <span class="ow">and</span> <span class="nb">len</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">zmin</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">zmax</span><span class="o">=</span><span class="n">arg</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">arg</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">()</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">zmin</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">zmax</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&#39;zlim: wrong number of arguments.&#39;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.close"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.close">[docs]</a>    <span class="k">def</span> <span class="nf">close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Close figure.</span>

<span class="sd">        Calling::</span>

<span class="sd">            close()</span>

<span class="sd">        closes the current figure.</span>

<span class="sd">        Calling::</span>

<span class="sd">            close(num)</span>

<span class="sd">        closes the figure with number num.</span>

<span class="sd">        Calling::</span>

<span class="sd">            close(fig)</span>

<span class="sd">        closes the Figure object fig.</span>

<span class="sd">        Calling::</span>

<span class="sd">            close(&#39;all&#39;)</span>

<span class="sd">        closes all figures.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">closefig</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;all&#39;</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">closefigs</span><span class="p">()</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">closefig</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;close: wrong number of arguments&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.closefig"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.closefig">[docs]</a>    <span class="k">def</span> <span class="nf">closefig</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">arg</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Close figure window.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;closefig not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.closefigs"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.closefigs">[docs]</a>    <span class="k">def</span> <span class="nf">closefigs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Close all figure windows.&quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="n">Figure</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_attrs</span><span class="p">[</span><span class="s">&#39;curfig&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
        <span class="c"># the rest should be written in subclass</span>
</div>
<div class="viewcode-block" id="BaseClass.grid"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.grid">[docs]</a>    <span class="k">def</span> <span class="nf">grid</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Toggle the display of grid lines.</span>

<span class="sd">        Calling::</span>

<span class="sd">            grid(&#39;on&#39;)</span>

<span class="sd">        displays grid lines in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            grid(&#39;off&#39;)</span>

<span class="sd">        removes the grid lines from the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            grid()</span>

<span class="sd">        toggles the display of grid lines in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            grid(ax, ...)</span>

<span class="sd">        uses Axis object ax instead of the current axis.</span>

<span class="sd">        Note that calling grid(True) and grid(False) is the same as calling</span>
<span class="sd">        grid(&#39;on&#39;) and grid(&#39;off&#39;), respectively.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">toggle</span><span class="p">(</span><span class="s">&#39;grid&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">grid</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;grid: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.legend"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.legend">[docs]</a>    <span class="k">def</span> <span class="nf">legend</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add legend(s) to the current plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            legend(string1, string2, string3,...)</span>

<span class="sd">        or</span>
<span class="sd">            legend([string1, string2, string3,...])</span>

<span class="sd">        adds legends to the current plot using the given strings as labels.</span>
<span class="sd">        Note that the number of strings should match the number of items in</span>
<span class="sd">        the current axis (i.e., getp(gca(), &#39;numberofitems&#39;)), but a</span>
<span class="sd">        less legends than curve items are allowed.xo</span>

<span class="sd">        Calling::</span>

<span class="sd">            legend(string)</span>

<span class="sd">        adds the given string as a legend to the last item added to the</span>
<span class="sd">        current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            legend(ax, ...)</span>

<span class="sd">        affects the Axis object ax instead of the current axis.</span>

<span class="sd">        The keyword arguments (**kwargs) are ignored, but makes it</span>
<span class="sd">        possible to seemlessly switch between easyviz and matplotlib.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">list</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">)):</span>
            <span class="c"># unpack the list/tuple to individual arguments</span>
            <span class="n">args</span> <span class="o">=</span> <span class="p">[</span><span class="n">e</span> <span class="k">for</span> <span class="n">e</span> <span class="ow">in</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>

        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="s">&#39;loc&#39;</span><span class="p">:</span>
                <span class="n">value</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
                <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">int</span><span class="p">):</span>
                    <span class="k">if</span> <span class="mi">0</span> <span class="o">&lt;=</span> <span class="n">value</span> <span class="o">&lt;=</span> <span class="mi">10</span><span class="p">:</span>
                        <span class="k">for</span> <span class="n">loc</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_legend_locs</span><span class="p">:</span>
                            <span class="k">if</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_legend_locs</span><span class="p">[</span><span class="n">loc</span><span class="p">]</span> <span class="o">==</span> <span class="n">value</span><span class="p">:</span>
                                <span class="n">value</span> <span class="o">=</span> <span class="n">loc</span>
                                <span class="k">break</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                            <span class="s">&#39;legend: wrong value of loc=</span><span class="si">%s</span><span class="s">, &#39;</span>
                            <span class="s">&#39;should be between 0 and 10&#39;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
                <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_legend_locs</span><span class="p">:</span>
                        <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                            <span class="s">&#39;legend: wrong value of loc=</span><span class="si">%s</span><span class="s">, &#39;</span>
                            <span class="s">&#39;should be</span><span class="se">\n</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                        <span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="nb">str</span><span class="p">([</span><span class="n">v</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">Axis</span><span class="o">.</span><span class="n">_legend_locs</span><span class="p">])[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</span><span class="p">]))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&#39;legend: wrong value of loc=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>

                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend_loc</span><span class="o">=</span><span class="n">value</span><span class="p">)</span>

            <span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">&#39;fancybox&#39;</span><span class="p">:</span>
                <span class="n">value</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="n">value</span> <span class="ow">in</span> <span class="p">(</span><span class="bp">True</span><span class="p">,</span> <span class="bp">False</span><span class="p">,</span> <span class="bp">None</span><span class="p">):</span>
                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&#39;legend: wrong value of fancybox=</span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> <span class="n">value</span><span class="p">)</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend_fancybox</span><span class="o">=</span><span class="n">value</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">print</span> <span class="s">&#39;legend: ignoring keyword argument &quot;</span><span class="si">%s</span><span class="s">&quot;&#39;</span> <span class="o">%</span> <span class="n">key</span>

        <span class="n">items</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">items</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">print</span> <span class="s">&#39;plot is empty, cannot add legend&#39;</span>
            <span class="k">return</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
            <span class="c"># Consistency check of len(args) and number of items in axis</span>
            <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">items</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="n">nargs</span><span class="p">:</span>
                <span class="c"># Iterate over items and set legend</span>
                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">nargs</span><span class="p">):</span>
                    <span class="n">items</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">]))</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">items</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;legend: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.title"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.title">[docs]</a>    <span class="k">def</span> <span class="nf">title</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add title to the current plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            title(s)</span>

<span class="sd">        adds the text given in s at the top of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            title(ax, ...)</span>

<span class="sd">        adds a title to the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">title</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;title: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.xlabel"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.xlabel">[docs]</a>    <span class="k">def</span> <span class="nf">xlabel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add a label to the x-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xlabel(s)</span>

<span class="sd">        adds the text given in s beside the x-axis on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            xlabel(ax, ...)</span>

<span class="sd">        adds the label to the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">xlabel</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;xlabel: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.ylabel"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.ylabel">[docs]</a>    <span class="k">def</span> <span class="nf">ylabel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add a label to the y-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ylabel(s)</span>

<span class="sd">        adds the text given in s beside the y-axis on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            ylabel(ax, ...)</span>

<span class="sd">        adds the label to the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">ylabel</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;ylabel: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.zlabel"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.zlabel">[docs]</a>    <span class="k">def</span> <span class="nf">zlabel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add a label to the z-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zlabel(s)</span>

<span class="sd">        adds the text given in s beside the z-axis on the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            zlabel(ax, ...)</span>

<span class="sd">        adds the zlabel to the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">zlabel</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;zlabel: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>

    <span class="c"># 2D Plotting</span></div>
<div class="viewcode-block" id="BaseClass.plot"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.plot">[docs]</a>    <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw line and scatter plots.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(x, y)</span>

<span class="sd">        plots y against x, i.e., if x and y are vectors of length n, then</span>
<span class="sd">        this will plot all the points (x[i], y[i]) for 0&lt;=i&lt;n.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(y)</span>

<span class="sd">        plots values in y on y-axis (same as plot(range(len(y)),y)).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(y, fmt)</span>

<span class="sd">        plots values in y on y-axis formated like fmt (see below).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(x1,y1,fmt1, x2,y2,fmt2, ...)</span>

<span class="sd">        same as hold(&#39;on&#39;) followed by multiple plot(x,y,fmt).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(x1,y1,x2,y2,...)</span>

<span class="sd">        like above, but automatically chooses different colors.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(y1,y2,...,x=x)</span>

<span class="sd">        uses x as the x values for all the supplied curves.</span>
<span class="sd">        x=&#39;auto&#39; has the same effect as x=range(len(y1)).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(...,log=mode)</span>

<span class="sd">        uses logarithmic (base 10) scales on either the x- or y-axes (or both).</span>
<span class="sd">        mode can be</span>

<span class="sd">          * &#39;x&#39;  - logarithmic scale on x-axis</span>
<span class="sd">          * &#39;y&#39;  - logarithmic scale on y-axis</span>
<span class="sd">          * &#39;xy&#39; - logarithmic scales on both x- and y-axes.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot(ax, ...)</span>

<span class="sd">        plots into the Axis object ax instead of the current axis.</span>

<span class="sd">        The plot command returns a list a of all Line objects created.</span>

<span class="sd">        The following format specifiers exist:</span>

<span class="sd">            y     yellow        .     point              -     solid</span>
<span class="sd">            m     magenta       o     circle             :     dotted</span>
<span class="sd">            c     cyan          x     x-mark             -.    dashdot</span>
<span class="sd">            r     red           +     plus               --    dashed</span>
<span class="sd">            g     green         *     star</span>
<span class="sd">            b     blue          s     square</span>
<span class="sd">            w     white         d     diamond</span>
<span class="sd">            k     black         v     triangle (down)</span>
<span class="sd">                                ^     triangle (up)</span>
<span class="sd">                                &lt;     triangle (left)</span>
<span class="sd">                                &gt;     triangle (right)</span>
<span class="sd">                                p     pentagram</span>
<span class="sd">                                h     hexagram</span>

<span class="sd">        Examples:</span>

<span class="sd">        Draw a line from a Python list:</span>
<span class="sd">        &gt;&gt;&gt; plot([1,2,3])</span>

<span class="sd">        Draw three red crosses:</span>
<span class="sd">        &gt;&gt;&gt; plot([1,2,3], &#39;rx&#39;)</span>

<span class="sd">        A somewhat more complex example:</span>
<span class="sd">        &gt;&gt;&gt; x = linspace(0, 15, 76)   # 0, 0.2, 0.4, ..., 15</span>
<span class="sd">        &gt;&gt;&gt; y1 = sin(x)*x</span>
<span class="sd">        &gt;&gt;&gt; y2 = sin(x)*sqrt(x)</span>
<span class="sd">        &gt;&gt;&gt; plot(x, y1, &#39;b-&#39;, x, y2, &#39;ro&#39;,</span>
<span class="sd">        ...      legend=(&#39;x*sin(x)&#39;, &#39;sqrt(x)*sin(x)&#39;))</span>

<span class="sd">        Note: loglog, semilogy, and semilogx are like plot(...,log=&#39;xy&#39;),</span>
<span class="sd">        plot(...,log=&#39;y&#39;), and plot(...,log=&#39;x&#39;), respectively.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="s">&#39;description&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;plot: 2D curve plot&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;plot: not enough arguments given&quot;</span><span class="p">)</span>

        <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> <span class="c"># store all Line instances here</span>
        <span class="c"># If first argument is a format string this will be ignored</span>
        <span class="c"># If two format strings are used only the first of them will be used</span>
        <span class="k">if</span> <span class="s">&#39;x&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">or</span> <span class="p">(</span><span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                    <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                      <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                      <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="o">+</span><span class="n">i</span><span class="p">]))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                            <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">2</span><span class="p">:</span>
                                <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                                  <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                                  <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span>  <span class="c"># x in kwargs is no longer needed</span>
        <span class="k">else</span><span class="p">:</span> <span class="c"># Normal case</span>
            <span class="c"># If an odd number, larger than 2, of non-strings in args are</span>
            <span class="c"># between two string arguments, something is wrong.</span>
            <span class="c"># If the odd number is one, the argument x=&#39;auto&#39; is passed.</span>
            <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="k">if</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">):</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span>
                                          <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                          <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
                    <span class="n">i</span><span class="o">+</span><span class="mi">100</span> <span class="c">#return</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;plot: cannot plot a formatstring&quot;</span><span class="p">)</span>

            <span class="k">while</span> <span class="n">i</span> <span class="o">&lt;=</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">3</span><span class="p">:</span>
                <span class="c"># This item is not string --&gt; y-value, should never be string.</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">]))</span>
                            <span class="n">i</span> <span class="o">=</span> <span class="n">i</span><span class="o">+</span><span class="mi">3</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                              <span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                            <span class="n">i</span> <span class="o">=</span> <span class="n">i</span><span class="o">+</span><span class="mi">2</span>

                    <span class="c"># Next element is str --&gt; no x-value</span>
                    <span class="k">else</span><span class="p">:</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                          <span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span>
                                          <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
                        <span class="n">i</span> <span class="o">=</span> <span class="n">i</span><span class="o">+</span><span class="mi">2</span>
                    <span class="c"># These last cases could be run outside the while loop</span>
                    <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">2</span><span class="p">:</span>
                        <span class="c"># Either y and format or x and y value left</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                    <span class="k">elif</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span>
                        <span class="c"># In this case we have only an y value left</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                          <span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span>
                                          <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>

        <span class="c"># add the lines to the axes in ax:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>

        <span class="c"># Set legends</span>
        <span class="k">if</span> <span class="s">&#39;legend&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">no_lines</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span> <span class="c"># number of lines added</span>
            <span class="n">legends</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legends</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span> <span class="c"># legends is a sequence</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">legends</span><span class="p">)</span> <span class="o">==</span> <span class="n">no_lines</span><span class="p">:</span>
                    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">no_lines</span><span class="p">):</span>
                        <span class="n">legend</span> <span class="o">=</span> <span class="n">legends</span><span class="p">[</span><span class="n">no_lines</span><span class="o">-</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legend</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="o">-</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="n">legend</span><span class="p">)</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="k">print</span> <span class="s">&quot;Legend &quot;</span><span class="o">+</span><span class="n">legend</span><span class="o">+</span><span class="s">&quot; is not a string&quot;</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">print</span> <span class="s">&#39;Number of legend items (</span><span class="si">%d</span><span class="s">) is not equal to &#39;</span>\
                          <span class="s">&#39;number of lines in plotcommand (</span><span class="si">%d</span><span class="s">)&#39;</span> <span class="o">%</span> \
                          <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">legends</span><span class="p">),</span> <span class="n">no_lines</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legends</span><span class="p">,</span><span class="nb">str</span><span class="p">):</span> <span class="c"># only one legend</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="n">legends</span><span class="p">)</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="s">&#39;legend_loc&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="c"># No test on validity as in legend method...</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend_loc</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend_loc&#39;</span><span class="p">])</span>
        <span class="k">if</span> <span class="s">&#39;legend_fancybox&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend_fancybox</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend_fancybox&#39;</span><span class="p">])</span>

        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="s">&#39;box&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;box&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>

        <span class="c"># set keyword arguments in all the added lines</span>
        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
            <span class="n">line</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="c"># automatically add line colors if this is not specified:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">line</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;linecolor&#39;</span><span class="p">):</span>
                <span class="n">line</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">linecolor</span><span class="o">=</span><span class="n">ax</span><span class="o">.</span><span class="n">get_next_color</span><span class="p">())</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>

        <span class="k">return</span> <span class="n">lines</span>
</div>
<div class="viewcode-block" id="BaseClass.loglog"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.loglog">[docs]</a>    <span class="k">def</span> <span class="nf">loglog</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a loglog plot with logarithmic scaling on x- and y-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            loglog(...)</span>

<span class="sd">        is the same as calling plot(...) with the exception that a</span>
<span class="sd">        logarithmic (base 10) scale is used for both x- and y-axes.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;xy&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.semilogx"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.semilogx">[docs]</a>    <span class="k">def</span> <span class="nf">semilogx</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a semilog plot with logarithmic scaling on x-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            semilogx(...)</span>

<span class="sd">        is the same as calling plot(...) with the exception that a</span>
<span class="sd">        logarithmic (base 10) scale is used for the x-axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;x&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.semilogy"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.semilogy">[docs]</a>    <span class="k">def</span> <span class="nf">semilogy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a semilog plot with logarithmic scaling on y-axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            semilogy(...)</span>

<span class="sd">        is the same as calling plot(...) with the exception that a</span>
<span class="sd">        logarithmic (base 10) scale is used for the y-axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;log&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;y&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.plot3"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.plot3">[docs]</a>    <span class="k">def</span> <span class="nf">plot3</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw lines and points in 3D space.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(x, y, z)</span>

<span class="sd">        plots z against x and y, i.e., if x, y, and z are vectors of length n,</span>
<span class="sd">        then this will plot all the points (x[i], y[i], z[i]) for 0&lt;=i&lt;n.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(z)</span>

<span class="sd">        plots values in z on the z-axis</span>
<span class="sd">        (same as plot3(range(len(z)), range(len(z)), z)).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(z, fmt)</span>

<span class="sd">        plots values in z on z-axis formated like fmt (see the plot command).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(x1,y1,z1,fmt1,x2,y2,z2,fmt2,...)</span>

<span class="sd">        same as hold(&#39;on&#39;) followed by multiple plot3(x,y,z,fmt).</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(x1,y1,z1,x2,y2,z2,...)</span>

<span class="sd">        like above, but automatically chooses different colors.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(z1,z2,...,x=x,y=y)</span>

<span class="sd">        uses x as the values on the x-axis and y as the values on the y-axis</span>
<span class="sd">        for all the supplied curves (assuming that all have the same length).</span>
<span class="sd">        By setting x=&#39;auto&#39; and y=&#39;auto&#39; has the same effect as</span>
<span class="sd">        x=range(len(z1)) and y=range(len(z1)), respectively.</span>

<span class="sd">        Calling::</span>

<span class="sd">            plot3(ax, ...)</span>

<span class="sd">        plots into the Axis object ax instead of the current axis.</span>

<span class="sd">        The plot3 command returns a list containing all the created Line</span>
<span class="sd">        objects.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; t = linspace(0,10*pi,301)</span>
<span class="sd">        &gt;&gt;&gt; plot3(sin(t), cos(t), t, title=&#39;A helix&#39;, grid=&#39;on&#39;)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;plot3: 3D line plot&#39;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;hidden&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;hidden&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">False</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;plot3: not enough arguments given&quot;</span><span class="p">)</span>

        <span class="n">lines</span> <span class="o">=</span> <span class="p">[]</span> <span class="c"># all Line instances are stored here</span>

        <span class="c"># If first argument is a format string this will be ignored</span>
        <span class="c"># If two format strings are used only the first of them will be used</span>
        <span class="k">if</span> <span class="s">&#39;x&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span> <span class="ow">and</span> <span class="s">&#39;y&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">or</span> <span class="p">(</span><span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span> <span class="ow">and</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">)):</span>
                <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
                    <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                      <span class="n">y</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span>
                                      <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                      <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                      <span class="n">y</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span>
                                      <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                      <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span>
                                              <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="o">+</span><span class="n">i</span><span class="p">]))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span>
                                              <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                            <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">2</span><span class="p">:</span>
                                <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">],</span>
                                                  <span class="n">y</span><span class="o">=</span><span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">],</span>
                                                  <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                                  <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
            <span class="c"># x and y in kwargs are no longer needed:</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;x&#39;</span><span class="p">]</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;y&#39;</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span> <span class="c"># Normal case</span>
            <span class="c"># If an odd number, larger than 2, of non-strings in args are</span>
            <span class="c"># between two string arguments, something is wrong.</span>
            <span class="c"># If the odd number is one, the argument x=&#39;auto&#39; is passed.</span>
            <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="k">if</span> <span class="n">nargs</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">):</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                    <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="c"># plot3(z)</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                          <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                    <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span> <span class="c"># plot3(z,fmt)</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
                    <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span> <span class="c"># plot3(x,y,z)</span>
                        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                    <span class="k">else</span><span class="p">:</span> <span class="c"># plot(x,y,z,fmt) or plot(z1,fmt1,z2,fmt2)</span>
                        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">3</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">3</span><span class="p">]))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">3</span><span class="p">]))</span>
                    <span class="n">i</span><span class="o">+</span><span class="mi">100</span> <span class="c">#return</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;plot3: cannot plot a formatstring&quot;</span><span class="p">)</span>

            <span class="k">while</span> <span class="n">i</span> <span class="o">&lt;=</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">5</span><span class="p">:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span> <span class="c"># should never be string</span>
                    <span class="c"># cases:</span>
                    <span class="c"># 1. plot3(x1,y1,z1,s1, x2,y2,z2,s2, ...)</span>
                    <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">3</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                                <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                                  <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                                  <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span>
                                                  <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">3</span><span class="p">]))</span>
                                <span class="n">i</span> <span class="o">+=</span> <span class="mi">4</span>
                            <span class="k">else</span><span class="p">:</span>
                                <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                                  <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                                  <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span>
                                                  <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                                <span class="n">i</span> <span class="o">+=</span> <span class="mi">3</span>
                    <span class="k">else</span><span class="p">:</span> <span class="c"># next element is str --&gt; no x and y values</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                          <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
                        <span class="n">i</span> <span class="o">+=</span> <span class="mi">2</span>

                    <span class="c"># 2. plot3(x1,y1,z1, x2,y2,z2, ...)</span>
                    <span class="c"># 3. plot3(z1,s1, z2,s2, ...)</span>

                    <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">4</span><span class="p">:</span>
                        <span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span>
                                              <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">3</span><span class="p">]))</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">3</span><span class="p">]))</span>
                    <span class="k">elif</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">3</span><span class="p">:</span> <span class="c"># x, y, and z left</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">y</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">2</span><span class="p">],</span>
                                          <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>
                    <span class="k">elif</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">2</span><span class="p">:</span> <span class="c"># only z and format string left</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">],</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                              <span class="n">format</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">]))</span>
                    <span class="k">elif</span> <span class="n">i</span> <span class="o">==</span> <span class="n">nargs</span><span class="o">-</span><span class="mi">1</span><span class="p">:</span> <span class="c"># only a z value left</span>
                        <span class="n">lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">Line</span><span class="p">(</span><span class="n">x</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">y</span><span class="o">=</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">],</span>
                                          <span class="n">format</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">))</span>

        <span class="c"># add the lines to the axes in ax:</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>

        <span class="c"># Set legends</span>
        <span class="k">if</span> <span class="s">&#39;legend&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">no_lines</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">lines</span><span class="p">)</span>
            <span class="n">legends</span> <span class="o">=</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legends</span><span class="p">,</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span> <span class="c"># legends is a sequence</span>
                <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">legends</span><span class="p">)</span> <span class="o">==</span> <span class="n">no_lines</span><span class="p">:</span>
                    <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">no_lines</span><span class="p">):</span>
                        <span class="n">legend</span> <span class="o">=</span> <span class="n">legends</span><span class="p">[</span><span class="n">no_lines</span><span class="o">-</span><span class="n">i</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
                        <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legend</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
                            <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="o">-</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="n">legend</span><span class="p">)</span>
                        <span class="k">else</span><span class="p">:</span>
                            <span class="k">print</span> <span class="s">&quot;Legend &quot;</span><span class="o">+</span><span class="n">legend</span><span class="o">+</span><span class="s">&quot; is not a string&quot;</span>
                <span class="k">else</span><span class="p">:</span>
                    <span class="k">print</span> <span class="s">&quot;Number of legend items (</span><span class="si">%d</span><span class="s">) is not equal to &quot;</span> \
                          <span class="s">&quot;number of lines (</span><span class="si">%d</span><span class="s">) in plotcommand&quot;</span> <span class="o">%</span> \
                          <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">legends</span><span class="p">),</span> <span class="n">no_lines</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">legends</span><span class="p">,</span><span class="nb">str</span><span class="p">):</span> <span class="c"># only one legend</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">legend</span><span class="o">=</span><span class="n">legends</span><span class="p">)</span>
            <span class="k">del</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;legend&#39;</span><span class="p">]</span>

        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>

        <span class="c"># set keyword arguments in all the added lines:</span>
        <span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">lines</span><span class="p">:</span>
            <span class="n">line</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
            <span class="c"># automatically add line colors if this is not specified:</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="n">line</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;linecolor&#39;</span><span class="p">):</span>
                <span class="n">line</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">linecolor</span><span class="o">=</span><span class="n">ax</span><span class="o">.</span><span class="n">get_next_color</span><span class="p">())</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>

        <span class="k">return</span> <span class="n">lines</span>
</div>
<div class="viewcode-block" id="BaseClass.fill"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.fill">[docs]</a>    <span class="k">def</span> <span class="nf">fill</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw filled 2D polygons.&quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;fill: filled 2D polygons&#39;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;edgecolor&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;edgecolor&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;k&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.stem"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.stem">[docs]</a>    <span class="k">def</span> <span class="nf">stem</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a stem plot.&quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;stem: stem plot&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.bar"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.bar">[docs]</a>    <span class="k">def</span> <span class="nf">bar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a bar graph.</span>

<span class="sd">        Calling::</span>

<span class="sd">           bar(data)</span>

<span class="sd">        where data is a dictionary on the form</span>

<span class="sd">          data = {&#39;method1&#39;: {&#39;thing1&#39;: value, &#39;thing2&#39;: value},</span>
<span class="sd">                  &#39;method2&#39;: {&#39;thing1&#39;: value, &#39;thing2&#39;: value},</span>
<span class="sd">                  &#39;method3&#39;: {&#39;thing1&#39;: value, &#39;thing2&#39;: value},}</span>

<span class="sd">        will draw m bars for every name (key in data), one for each key in</span>
<span class="sd">        data[name], where the height indicates the value. The name is placed</span>
<span class="sd">        beneath each of the bar groups on the x axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            bar(Y)</span>

<span class="sd">        will draw a bar for each of the elements in the vector/matrix Y.</span>
<span class="sd">        If Y is a matrix, a group of bars from the elements of each row of</span>
<span class="sd">        Y will be created.</span>

<span class="sd">        Calling::</span>

<span class="sd">            bar(x,Y)</span>

<span class="sd">        is the same as above only that the values on the x axis is defined</span>
<span class="sd">        by the vector x.</span>

<span class="sd">        Calling::</span>

<span class="sd">            bar(..., width)</span>

<span class="sd">        uses the specified width on the bars. The default width is 0.8, while</span>
<span class="sd">        a width of 1.0 should make the bars just touch each other (might vary</span>
<span class="sd">        in the different backends).</span>

<span class="sd">        Calling::</span>

<span class="sd">            bar(..., color)</span>

<span class="sd">        uses the given color for all the bars.</span>

<span class="sd">        Calling::</span>

<span class="sd">            bar(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Bars object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; from numpy.random import rand</span>
<span class="sd">        &gt;&gt;&gt; bar(rand(4))</span>

<span class="sd">        &gt;&gt;&gt; figure()</span>
<span class="sd">        &gt;&gt;&gt; bar(rand(4,3))</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;bar: bar graph&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Bars</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;box&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;box&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.quiver"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.quiver">[docs]</a>    <span class="k">def</span> <span class="nf">quiver</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw arrows from a 2D vector field.</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver(X, Y, U, V)</span>

<span class="sd">        displays vectors as arrows with components U and V at the grid</span>
<span class="sd">        defined by X and Y. The arrays U and V must both have the same shape</span>
<span class="sd">        and the grid components X and Y must either have the same shape as</span>
<span class="sd">        U or fulfill the requirement len(X)==n and len(y)==m, where</span>
<span class="sd">        m,n=shape(u).</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver(U, V)</span>

<span class="sd">        is the same as calling quiver(range(n),range(m),U,V), where</span>
<span class="sd">        m,n=shape(u)).</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver(..., &#39;filled&#39;)</span>

<span class="sd">        draw filled arrows.</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver(..., fmt)</span>

<span class="sd">        sets the line specification as given in the format string fmt. See</span>
<span class="sd">        the plot command for further details on specifying the format string.</span>

<span class="sd">        Examples:</span>

<span class="sd">        Plot the gradient field of the function z = x**2 + y**2:</span>
<span class="sd">        &gt;&gt;&gt; x = y = linspace(-2, 2, 21)</span>
<span class="sd">        &gt;&gt;&gt; xv, yv = meshgrid(x,y)</span>
<span class="sd">        &gt;&gt;&gt; values = xv**2 + yv**2</span>
<span class="sd">        &gt;&gt;&gt; contour(xv, yv, values, 10, hold=&#39;on&#39;)</span>
<span class="sd">        &lt;scitools.easyviz.common.Contours object at 0xb45f374c&gt;</span>
<span class="sd">        &gt;&gt;&gt; uv, vv = gradient(values, 0.2)</span>
<span class="sd">        &gt;&gt;&gt; quiver(xv, yv, uv, vv)</span>
<span class="sd">        &lt;scitools.easyviz.common.VelocityVectors object at 0xb45435cc&gt;</span>
<span class="sd">        &gt;&gt;&gt; hold(&#39;off&#39;)</span>

<span class="sd">        Another example:</span>
<span class="sd">        &gt;&gt;&gt; x = linspace(0,3,80)</span>
<span class="sd">        &gt;&gt;&gt; y = sin(2*pi*x)</span>
<span class="sd">        &gt;&gt;&gt; theta = 2*pi*x+pi/2</span>
<span class="sd">        &gt;&gt;&gt; u = sin(theta)/10</span>
<span class="sd">        &gt;&gt;&gt; v = cos(theta)/10</span>
<span class="sd">        &gt;&gt;&gt; quiver(x,y,u,v,0.04,&#39;b&#39;,hold=&#39;on&#39;)</span>
<span class="sd">        &lt;scitools.easyviz.common.VelocityVectors object at 0xb768e1cc&gt;</span>
<span class="sd">        &gt;&gt;&gt; plot(x,y,&#39;r&#39;)</span>
<span class="sd">        [&lt;scitools.easyviz.common.Line object at 0xb768e36c&gt;]</span>
<span class="sd">        &gt;&gt;&gt; hold(&#39;off&#39;)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;quiver: 2D vector field&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">VelocityVectors</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="s">&#39;quiver3&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;grid&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;grid&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;box&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;box&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.contour"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.contour">[docs]</a>    <span class="k">def</span> <span class="nf">contour</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a 2D contour plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(X, Y, Z)</span>

<span class="sd">        displays a contour plot where the values in the scalar field Z are</span>
<span class="sd">        treated as heights above a plane. The grid components X and Y must</span>
<span class="sd">        either have the same shape as Z or fulfill the requirement len(X)==n</span>
<span class="sd">        and len(Y)==m, where m,n=shape(Z).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(Z)</span>

<span class="sd">        is the same as calling contour(range(n),range(m),Z), where</span>
<span class="sd">        m,n=shape(Z).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(..., n)</span>

<span class="sd">        displays a contour plot with n contour lines (default is 8 lines).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(..., v)</span>

<span class="sd">        displays contours at levels given in the array v.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(..., fmt)</span>

<span class="sd">        uses the color and line style as given in the format string fmt to</span>
<span class="sd">        draw the contour lines (see the plot command for further details on</span>
<span class="sd">        format strings). This overrides the default behavior of using the</span>
<span class="sd">        current colormap to color the contour lines.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contours(ax, ...)</span>

<span class="sd">        plots into the Axis object ax instead of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour(...,clabels=&#39;on&#39;)</span>

<span class="sd">        is the same as calling h=contour(...) followed by clabel(h,&#39;on&#39;).</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; # draw a contour plot of the peaks function:</span>
<span class="sd">        &gt;&gt;&gt; x = y = linspace(-3, 3, 13)</span>
<span class="sd">        &gt;&gt;&gt; xv, yv = meshgrid(x, y)</span>
<span class="sd">        &gt;&gt;&gt; values = peaks(xv, yv)</span>
<span class="sd">        &gt;&gt;&gt; contour(xv, yv, values)</span>

<span class="sd">        Draw 10 red contour lines with double line width:</span>
<span class="sd">        &gt;&gt;&gt; contour(xv, yv, values, 10, &#39;r&#39;, linewidth=2)</span>

<span class="sd">        Draw contour lines at -2, 0, 2, and 5:</span>
<span class="sd">        &gt;&gt;&gt; contour(xv, yv, values, [-2,0,2,5])</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;contour: 2D contours at base&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Contours</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="s">&#39;contour3&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;grid&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;grid&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
            <span class="k">else</span><span class="p">:</span>  <span class="c"># contour or contourf</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;box&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;box&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">h</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;function&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s">&#39;contour3&#39;</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">view</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.contourf"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.contourf">[docs]</a>    <span class="k">def</span> <span class="nf">contourf</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw filled contour plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourf(...)</span>

<span class="sd">        is the same as calling contour(...) with the exception that the space</span>
<span class="sd">        between the contour lines is filled with colors.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; contourf(peaks(), clabel=&#39;on&#39;, colorbar=&#39;on&#39;)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;contourf: 2D filled contour plot&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">contour</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="c"># 3D plotting</span>
</div>
<div class="viewcode-block" id="BaseClass.pcolor"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.pcolor">[docs]</a>    <span class="k">def</span> <span class="nf">pcolor</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a 2D pseudocolor plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            pcolor(C)</span>

<span class="sd">        draw a pseudocolor plot of the 2D array C.</span>

<span class="sd">        Calling::</span>

<span class="sd">            pcolor(X,Y,C)</span>

<span class="sd">        same as above, only that the grid is specified by the X and Y arrays.</span>
<span class="sd">        These arrays must either have the same shape as C or fulfill the</span>
<span class="sd">        requirement len(X)==n and len(Y)==m, where m,n=shape(C).</span>

<span class="sd">        Calling::</span>

<span class="sd">            pcolor(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        Examples:</span>

<span class="sd">        Simple pseudocolor plot:</span>
<span class="sd">        &gt;&gt;&gt; pcolor(peaks(31))</span>

<span class="sd">        Draw a pseudocolor plot with interpolated shading:</span>
<span class="sd">        &gt;&gt;&gt; pcolor(peaks(), shading=&#39;interp&#39;,</span>
<span class="sd">        ...        colorbar=&#39;on&#39;, colormap=hot())</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;pcolor: pseudocolor plot&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Surface</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="s">&#39;box&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;box&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.fill3"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.fill3">[docs]</a>    <span class="k">def</span> <span class="nf">fill3</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw filled 3D polygons.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&quot;&#39;fill3&#39; is not implemented.&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.streamline"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.streamline">[docs]</a>    <span class="k">def</span> <span class="nf">streamline</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw streamlines from 2D or 3D vector data.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(X,Y,Z,U,V,W,startx,starty,startz)</span>

<span class="sd">        will draw streamlines from the 3D vector field with components</span>
<span class="sd">        U,V,W defined on the grid given by X,Y,Z. The arrays U,V,W should</span>
<span class="sd">        all have the same shape and the grid components X,Y,Z must either</span>
<span class="sd">        have the same shape as U or fulfill the requirement len(X)==n,</span>
<span class="sd">        len(Y)==m, and len(Z)==p, where m,n,p=shape(U). The starting</span>
<span class="sd">        positions for the streamlines are defined in the arrays startx,</span>
<span class="sd">        starty, and startz.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(U,V,W,startx,starty,startz)</span>

<span class="sd">        is the same as above, except that it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(X,Y,U,V,startx,starty)</span>

<span class="sd">        will draw streamlines from the 2D vector field with components U,V</span>
<span class="sd">        defined on the grid given by X,Y. The arrays U,V should have the same</span>
<span class="sd">        shape and the grid componetns X,Y mist either have the same shape as</span>
<span class="sd">        U or fulfill the requirement len(X)==n and len(Y)==m, where</span>
<span class="sd">        m,n=shape(u). The starting positions for the streamlines are defined</span>
<span class="sd">        in the arrays startx and starty.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(U,V,startx,starty)</span>

<span class="sd">        is the same as above, except that it is assumed that</span>
<span class="sd">        X,Y = meshgrid(range(n),range(m)), where m,n=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(..., stepsize)</span>

<span class="sd">        uses the given step size instead of the default step size of 0.1.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamline(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        The streamline command returns a Streams object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        FIXME: Add streamline example.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;streamline: 2D or 3D streamline&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Streams</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.streamtube"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.streamtube">[docs]</a>    <span class="k">def</span> <span class="nf">streamtube</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw stream tubes from 3D vector data.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamtube(...)</span>

<span class="sd">        is the same as calling streamlines(...), except that only 3D vector</span>
<span class="sd">        fields are supported by the streamtube command. The optional</span>
<span class="sd">        positional argument stepsize is not supported either.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamtube(..., [scale, n])</span>

<span class="sd">        will scale the width of the tubes according to scale (default is 1),</span>
<span class="sd">        while the variable n sets the number of points along the</span>
<span class="sd">        circumference of the tube (default is 20).</span>

<span class="sd">        Examples:</span>

<span class="sd">        FIXME: Add streamtube example.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;streamtube: 3D stream tube&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">streamline</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.streamribbon"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.streamribbon">[docs]</a>    <span class="k">def</span> <span class="nf">streamribbon</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw stream ribbons from 3D vector data.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamribbon(...)</span>

<span class="sd">        is the same as calling streamlines(...), except that only 3D vector</span>
<span class="sd">        fields are supported by the streamribbon command. The optional</span>
<span class="sd">        positional argument stepsize is not supported either.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamribbon(..., width)</span>

<span class="sd">        specifies the width of the ribbons.</span>

<span class="sd">        Examples:</span>

<span class="sd">        FIXME: Add streamribbon example.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;streamribbon: 3D stream ribbon&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">streamline</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.mesh"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.mesh">[docs]</a>    <span class="k">def</span> <span class="nf">mesh</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a 3D mesh surface.</span>

<span class="sd">        Calling::</span>

<span class="sd">            mesh(X, Y, Z[, C])</span>

<span class="sd">        plots the colored mesh defined by scalar field Z defined on the grid</span>
<span class="sd">        given by X and Y. The grid components X and Y must either have the</span>
<span class="sd">        same shape as Z or fulfill the requirement len(X)==n and len(Y)==m,</span>
<span class="sd">        where m,n=shape(Z). The color is determined by the array C which must</span>
<span class="sd">        have the same shape as Z. If the color array C is not given, Z is used</span>
<span class="sd">        as the color array (i.e., C=Z).</span>

<span class="sd">        Calling::</span>

<span class="sd">            mesh(Z[, C])</span>

<span class="sd">        is the same as calling mesh(range(n), range(m), Z[, C]),</span>
<span class="sd">        where m,n = shape(Z).</span>

<span class="sd">        Calling::</span>

<span class="sd">            mesh(ax, ...)</span>

<span class="sd">        plots into the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Surface object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; x = y = linspace(-2, 2, 21)</span>
<span class="sd">        &gt;&gt;&gt; xx, yy = meshgrid(x, y)</span>
<span class="sd">        &gt;&gt;&gt; zz = exp(-xx**2)*exp(-yy**2)</span>
<span class="sd">        &gt;&gt;&gt; mesh(xx, yy, zz)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;mesh: 3D mesh&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Surface</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;grid&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;grid&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
            <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.meshc"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.meshc">[docs]</a>    <span class="k">def</span> <span class="nf">meshc</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a mesh with a contour plot beneath.</span>

<span class="sd">        Calling::</span>

<span class="sd">            meshc(...)</span>

<span class="sd">        is the same as calling mesh(...) only that a contour plot is drawn</span>
<span class="sd">        beneath the mesh.</span>

<span class="sd">        Examples:</span>

<span class="sd">        Draw a mesh with contour lines:</span>
<span class="sd">        &gt;&gt;&gt; x = linspace(-2, 2, 21)</span>
<span class="sd">        &gt;&gt;&gt; xx, yy = meshgrid(x)</span>
<span class="sd">        &gt;&gt;&gt; zz = peaks(xx, yy)</span>
<span class="sd">        &gt;&gt;&gt; meshc(xx, yy, zz)</span>

<span class="sd">        Draw a mesh with 20 contour lines:</span>
<span class="sd">        &gt;&gt;&gt; meshc(xx, yy, zz, clevels=20)</span>

<span class="sd">        Draw a mesh with contour lines at height -0.2, -0.5, 0.2, 0.5:</span>
<span class="sd">        &gt;&gt;&gt; meshc(xx, yy, zz, cvector=[-0.2,-0.5,0.2,0.5])</span>

<span class="sd">        Draw a mesh with contours and label the contours:</span>
<span class="sd">        &gt;&gt;&gt; meshc(xx, yy, zz, clabels=&#39;on&#39;)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;meshc: 3D mesh with contours at base&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mesh</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.surf"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.surf">[docs]</a>    <span class="k">def</span> <span class="nf">surf</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a 3D solid surface.</span>

<span class="sd">        Calling::</span>

<span class="sd">            surf(...)</span>

<span class="sd">        is the same as calling mesh(...), except that a solid colored surface</span>
<span class="sd">        is drawn instead of a wireframe mesh.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; x = linspace(-2, 2, 21)</span>
<span class="sd">        &gt;&gt;&gt; xx, yy = meshgrid(x)</span>
<span class="sd">        &gt;&gt;&gt; zz = xx**2 + yy**2</span>
<span class="sd">        &gt;&gt;&gt; surf(xx, yy, zz)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;surf: 3D surface&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mesh</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.surfc"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.surfc">[docs]</a>    <span class="k">def</span> <span class="nf">surfc</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a solid surface with contours beneath.</span>

<span class="sd">        Calling::</span>

<span class="sd">            surfc(...)</span>

<span class="sd">        is the same as calling surf(...) only that a contour plot is drawn</span>
<span class="sd">        beneath the surface.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;surfc: 3D surface with contours at base&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">surf</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.surfl"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.surfl">[docs]</a>    <span class="k">def</span> <span class="nf">surfl</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;3D shaded surface with lighting.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="n">NotImplemetedError</span><span class="p">(</span><span class="s">&quot;&#39;surfl&#39; is not implemented&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.quiver3"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.quiver3">[docs]</a>    <span class="k">def</span> <span class="nf">quiver3</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw velocity vectors in 3D space.</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(X, Y, Z, U, V, W)</span>

<span class="sd">        plots arrows from the 3D vector field with components U,V,W at the</span>
<span class="sd">        grid defined by X,Y,Z. The shape of the three vector components is</span>
<span class="sd">        assumed to be the same, while the grid components must either have</span>
<span class="sd">        the same shape as U or fulfill the requirements len(X)==n, len(Y)==m,</span>
<span class="sd">        and len(Z)==p, where m,n,p=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(Z,U,V,W)</span>

<span class="sd">        gives the same result as above, but it is assumed that</span>
<span class="sd">        X,Y = meshgrid(range(n),range(m)), where m,n=shape(Z).</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(..., s)</span>

<span class="sd">        scales the arrows by the scale factor given in s. The default is s=1,</span>
<span class="sd">        while a value of s=0 turns off automatic scaling.</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(..., &#39;filled&#39;)</span>

<span class="sd">        fills the arrows.</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(..., fmt)</span>

<span class="sd">        sets the specification on the arrows as given in the format string</span>
<span class="sd">        fmt (see the plot command for further information on format strings).</span>

<span class="sd">        Calling::</span>

<span class="sd">            quiver3(ax, ...)</span>

<span class="sd">        plots the vectors in the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A VelocityVectors object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        Draw the &quot;radius vector field&quot; v = (x,y,z):</span>
<span class="sd">        &gt;&gt;&gt; x = y = linspace(-3,3,4)</span>
<span class="sd">        &gt;&gt;&gt; xv, yv, zv = meshgrid(x, y, sparse=False)</span>
<span class="sd">        &gt;&gt;&gt; yv, vv, wv = xv, yv, zv</span>
<span class="sd">        &gt;&gt;&gt; quiver3(xv, yv, zv, uv, uv, wv, &#39;filled&#39;, &#39;r&#39;,</span>
<span class="sd">        ...         axis=[-7,7,-7,7,-7,7])</span>

<span class="sd">        Draw the path of a projectile as a function of time:</span>
<span class="sd">        FIXME: This example is taken from ...</span>
<span class="sd">        &gt;&gt;&gt; vz = 10  # Velocity</span>
<span class="sd">        &gt;&gt;&gt; a = -32  # Acceleration</span>
<span class="sd">        &gt;&gt;&gt; t = linspace(0,1,11)</span>
<span class="sd">        &gt;&gt;&gt; z = vz*t + 1./2*a*t**2</span>
<span class="sd">        &gt;&gt;&gt; vx = 2</span>
<span class="sd">        &gt;&gt;&gt; x = vx*t</span>
<span class="sd">        &gt;&gt;&gt; vy = 3</span>
<span class="sd">        &gt;&gt;&gt; y = vy*t</span>
<span class="sd">        &gt;&gt;&gt; u = gradient(x)</span>
<span class="sd">        &gt;&gt;&gt; v = gradient(y)</span>
<span class="sd">        &gt;&gt;&gt; w = gradient(z)</span>
<span class="sd">        &gt;&gt;&gt; scale = 0</span>
<span class="sd">        &gt;&gt;&gt; quiver3(x,y,z,u,v,w,0,view=[70,18],grid=&#39;on&#39;,</span>
<span class="sd">        ...         axis=[0,3.5,0,3,-10,2])</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;quiver3: 3D vector field&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">quiver</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.contour3"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.contour3">[docs]</a>    <span class="k">def</span> <span class="nf">contour3</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw 3D contour plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contour3(...)</span>

<span class="sd">        is the same as calling contour(...), except that the contours are</span>
<span class="sd">        drawn at their coresponding height level.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; contour3(peaks())</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;contour3: 3D contours at surface&quot;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">contour</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

    <span class="c"># Volume plotting</span></div>
<div class="viewcode-block" id="BaseClass.slice_"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.slice_">[docs]</a>    <span class="k">def</span> <span class="nf">slice_</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw volumetric slice plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice_(X,Y,Z,V,Sx,Sy,Sz)</span>

<span class="sd">        draws orthogonal slice planes through the volumetric data set V</span>
<span class="sd">        defined on the grid with components X, Y, and Z. The grid components</span>
<span class="sd">        must either have the same shape as V or fulfill the requirement</span>
<span class="sd">        len(X)==n, len(Y)==m, and len(Z)==p, where m,n,p=shape(V). The Sx,</span>
<span class="sd">        Sy, and Sz arrays defines the slice planes in the x, y, and z</span>
<span class="sd">        direction, respectively.</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice_(V,Sx,Sy,Sz)</span>

<span class="sd">        is the same as calling slice_(range(n),range(m),range(p),V,Sx,Sy,Sz),</span>
<span class="sd">        where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice_(X,Y,Z,V,XI,YI,ZI)</span>

<span class="sd">        draws slices through the volumetric data set V along the surface</span>
<span class="sd">        defined by the arrays XI,YI,ZI.</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice_(V,XI,YI,ZI)</span>

<span class="sd">        is the same as calling slice_(range(n),range(m),range(p)),V,XI,YI,ZI),</span>
<span class="sd">        where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice_(..., method)</span>

<span class="sd">        sets which interpolation method to be used, where method can be either</span>
<span class="sd">        &#39;linear&#39; (default), &#39;cubic&#39;, or &#39;nearest&#39;.</span>

<span class="sd">        Calling::</span>

<span class="sd">            slice(ax, ...)</span>

<span class="sd">        plots into the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Volume object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        Visualize the function x*exp(-x**2-y**2-z**2) over the range</span>
<span class="sd">        -2 &gt; x,y,z &lt; 2:</span>
<span class="sd">        &gt;&gt;&gt; xx, yy, zz = meshgrid(linspace(-2,2,21), linspace(-2,2,17),</span>
<span class="sd">        ...                       linspace(-2,2,25))</span>
<span class="sd">        &gt;&gt;&gt; vv = x*exp(-xx**2-yy**2-zz**2)</span>
<span class="sd">        &gt;&gt;&gt; slice_(xx, yy, zz, vv, [-1.2,.8,2], 2, [-2,-.2])</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;description&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;slice_: volumetric slices&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Volume</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">):</span>
            <span class="k">if</span> <span class="s">&#39;slice_&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]:</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;grid&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;grid&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">True</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
                    <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.contourslice"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.contourslice">[docs]</a>    <span class="k">def</span> <span class="nf">contourslice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw contour lines in slice planes.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(X,Y,Z,V,Sx,Sy,Sz)</span>

<span class="sd">        will draw contour lines in planes aligned with the coordinate axes</span>
<span class="sd">        at the points in the arrays Sx, Sy, and Sz. The arrays X, Y, and Z</span>
<span class="sd">        defines the grid coordinates for the volume V and they must either</span>
<span class="sd">        have the same shape as V or fulfill the requirement len(X)==n,</span>
<span class="sd">        len(Y)==m, and len(Z)==p, where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(V,Sx,Sy,Sz)</span>

<span class="sd">        is the same as above, but it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(X,Y,Z,V,XI,YI,ZI)</span>

<span class="sd">        will draw contour lines through the volume V along the surface given</span>
<span class="sd">        in the arrays XI, YI, and ZI.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(V,XI,YI,ZI)</span>

<span class="sd">        is the same as above, but it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(..., n)</span>

<span class="sd">        will draw n contour lines per plane instead of the default of five</span>
<span class="sd">        contour lines.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(..., v)</span>

<span class="sd">        will draw contour lines at the levels given in the array v.</span>

<span class="sd">        Calling::</span>

<span class="sd">            contourslice(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Volume object.</span>

<span class="sd">        Example:</span>
<span class="sd">        &gt;&gt;&gt; xx, yy, zz = meshgrid(linspace(-2,2,21), linspace(-2,2,17),</span>
<span class="sd">        ...                       linspace(-2,2,25))</span>
<span class="sd">        &gt;&gt;&gt; vv = xx*exp(-xx**2-yy**2-zz**2)</span>
<span class="sd">        &gt;&gt;&gt; contourslice(xx, yy, zz, vv, [-.7,.7], [], [0], view=3)</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;contourslice: contours in slice planes&#39;</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">slice_</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.coneplot"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.coneplot">[docs]</a>    <span class="k">def</span> <span class="nf">coneplot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw a 3D cone plot.</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(X,Y,Z,U,V,W,Cx,Cy,Cz)</span>

<span class="sd">        draws velocity vectors as cones from the 3D vector field defined by</span>
<span class="sd">        U, V, and W at the points given in the arrays Cx, Cy, and Cz. The</span>
<span class="sd">        arrays X, Y, and Z defines the grid coordinates for vector field. The</span>
<span class="sd">        shape of U, V, and W is assumed to be the same, while the grid</span>
<span class="sd">        components must either have the same shape as U or fulfill the</span>
<span class="sd">        requirement len(X)==n, len(Y)==m, and len(Z)==p, where m,n,p=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(U,V,W,Cx,Cy,Cz)</span>

<span class="sd">        is the same as above, but it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p = shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(..., scale)</span>

<span class="sd">        will automatically scale the cones by the factor scale (default is 1).</span>
<span class="sd">        To turn of automatic scaling, use a scale value of 0.</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(..., C)</span>

<span class="sd">        uses the colors in the array C to color the cones (C must have the</span>
<span class="sd">        same shape as U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(..., &#39;quiver&#39;)</span>

<span class="sd">        will plot arrows instead of cones.</span>

<span class="sd">        Calling::</span>

<span class="sd">            coneplot(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Streams object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        FIXME: Add conplot example.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;coneplot: 3D cone plot&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Streams</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.streamslice"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.streamslice">[docs]</a>    <span class="k">def</span> <span class="nf">streamslice</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw streamlines in axis aligned slice planes.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(X,Y,Z,U,V,W,startx,starty,startz)</span>

<span class="sd">        will draw streamlines (with direction arrows) from the 3D vector field</span>
<span class="sd">        with components U, V, and W in planes aligned with the coordinate axes</span>
<span class="sd">        at the points given in the arrays startx, starty, and startz. The</span>
<span class="sd">        arrays U, V, and W must all have the same shape and the grid</span>
<span class="sd">        coordinates given in the arrays X, Y, and Z must either have the same</span>
<span class="sd">        shape as U or fulfill the requirement len(X)==n, len(Y)==m, and</span>
<span class="sd">        len(Z)==p, where m,n,p=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(U,V,W,startx,starty,startz)</span>

<span class="sd">        is the same as above, except that it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(X,Y,U,V)</span>

<span class="sd">        will draw streamlines from the 2D vector field with components U and</span>
<span class="sd">        V. The vector components must have equal shape and the arrays X and Y</span>
<span class="sd">        should either have the same shape as U or fulfill the requirement</span>
<span class="sd">        len(X)==n and len(Y)==m, where m,n=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(U,V)</span>

<span class="sd">        is the same as above, except that it is assumed that</span>
<span class="sd">        X,Y = meshgrid(range(n),range(m)), where m,n=shape(U).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(..., &#39;arrows&#39;)</span>

<span class="sd">        will display direction arrows (default).</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(..., &#39;noarrows&#39;)</span>

<span class="sd">        will not display direction arrows.</span>

<span class="sd">        Calling::</span>

<span class="sd">            streamslice(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A ??? object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; import scipy</span>
<span class="sd">        &gt;&gt;&gt; wind = scipy.io.loadmat(&#39;wind.mat&#39;)</span>
<span class="sd">        &gt;&gt;&gt; x = wind[&#39;x&#39;]</span>
<span class="sd">        &gt;&gt;&gt; y = wind[&#39;y&#39;]</span>
<span class="sd">        &gt;&gt;&gt; z = wind[&#39;z&#39;]</span>
<span class="sd">        &gt;&gt;&gt; u = wind[&#39;u&#39;]</span>
<span class="sd">        &gt;&gt;&gt; v = wind[&#39;v&#39;]</span>
<span class="sd">        &gt;&gt;&gt; w = wind[&#39;w&#39;]</span>
<span class="sd">        &gt;&gt;&gt; streamslice(x,y,z,u,v,w,[],[],[4],daspect=[1,1,1])</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&quot;&#39;streamslice&#39; is not implemented.&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.isocaps"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.isocaps">[docs]</a>    <span class="k">def</span> <span class="nf">isocaps</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw isosurface end caps.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&quot;&#39;isocaps&#39; is not implemented.&quot;</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.isosurface"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.isosurface">[docs]</a>    <span class="k">def</span> <span class="nf">isosurface</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Draw isosurfaces from 3D scalar fields.</span>

<span class="sd">        Calling::</span>

<span class="sd">            isosurface(X,Y,Z,V,isovalue)</span>

<span class="sd">        creates an isosurface for the volume V at the iso value given by</span>
<span class="sd">        isovalue. The arrays X, Y, and Z defines the grid for the volume V</span>
<span class="sd">        and they must either have the same shape as V or fulfill the</span>
<span class="sd">        requirement len(X)==n, len(Y)==m, and len(Z)==p, where</span>
<span class="sd">        m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            isosurface(V,isovalue)</span>

<span class="sd">        is the same as above, but it is assumed that</span>
<span class="sd">        X,Y,Z = meshgrid(range(n),range(m),range(p)), where m,n,p = shape(V).</span>

<span class="sd">        Calling::</span>

<span class="sd">            isosurface(..., C)</span>

<span class="sd">        uses the colors in the array C instead of the colors in the</span>
<span class="sd">        scalar field V (C and V must have the same shape).</span>

<span class="sd">        @return: A Volume object.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; x, y, z, v = flow()</span>
<span class="sd">        &gt;&gt;&gt; isosurface(x, y, z, v, -3, daspect=[1,1,1])</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;description&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&#39;isosurface: isosurface extractor&#39;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>
        <span class="n">h</span> <span class="o">=</span> <span class="n">Volume</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">h</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;hold&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="s">&#39;view&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;view&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="mi">3</span>
        <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gcf</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">h</span>
</div>
<div class="viewcode-block" id="BaseClass.show"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.show">[docs]</a>    <span class="k">def</span> <span class="nf">show</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Redraw the current figure.&quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.hidden"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.hidden">[docs]</a>    <span class="k">def</span> <span class="nf">hidden</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Toggle hidden line removal in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hidden(state)</span>

<span class="sd">        turns hidden line removal on if state is &#39;on&#39; (or True) and off if</span>
<span class="sd">        state is &#39;off&#39; (or False). Hidden line removal is turned on by</span>
<span class="sd">        default.</span>

<span class="sd">        Calling::</span>

<span class="sd">            hidden()</span>

<span class="sd">        toggles the hidden state.</span>

<span class="sd">        Note: Some backends has no support for hidden line removal (e.g.,</span>
<span class="sd">        VTK).</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">hidden</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">toggle</span><span class="p">(</span><span class="s">&#39;hidden&#39;</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;hidden: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.view"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.view">[docs]</a>    <span class="k">def</span> <span class="nf">view</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Specify viewpoint.</span>

<span class="sd">        Calling::</span>

<span class="sd">            view(azimuth, elevation)</span>

<span class="sd">        sets the viewpoint according to azimuth (horizontal rotation) and</span>
<span class="sd">        elevation (vertical). Both azimuth and elevation should be given in</span>
<span class="sd">        degrees.</span>

<span class="sd">        Calling::</span>

<span class="sd">            view([azimuth, elevation])</span>

<span class="sd">        is the same as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            view(2)</span>

<span class="sd">        changes the view to the default 2D view.</span>

<span class="sd">        Calling::</span>

<span class="sd">            view(3)</span>

<span class="sd">        changes the view to the default 3D view.</span>

<span class="sd">        Calling::</span>

<span class="sd">            view(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        Examples:</span>

<span class="sd">        &gt;&gt;&gt; surf(peaks())</span>
<span class="sd">        &gt;&gt;&gt; view(2)      # the default 2D view</span>
<span class="sd">        &gt;&gt;&gt; view(40,65)  # azimuth=40 and elevation=65</span>
<span class="sd">        &gt;&gt;&gt; view(3)      # back to the default 3D view</span>
<span class="sd">        &gt;&gt;&gt; surf(peaks(),view=[35,75])  # as a keyword argument</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="c"># Allow both view(az,el) and view([az,el])</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>  <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span><span class="nb">float</span><span class="p">))</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">3</span><span class="p">):</span>
                <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">view</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">azimuth</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">elevation</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camdolly"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camdolly">[docs]</a>    <span class="k">def</span> <span class="nf">camdolly</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Dolly camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camdolly(dx, dy, dz)</span>

<span class="sd">        moves the camera position along the direction of projection.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camdolly(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camdolly</span><span class="o">=</span><span class="n">args</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camdolly: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camlookat"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camlookat">[docs]</a>    <span class="k">def</span> <span class="nf">camlookat</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Move camera and target to view specified objects.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlookat(obj)</span>

<span class="sd">        views the PlotProperties object obj.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlookat(ax)</span>

<span class="sd">        views the objects in the Axis object ax.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlookat()</span>

<span class="sd">        views the objects in the current axes.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camlookat</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">())</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">tmparg</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmparg</span><span class="p">,</span> <span class="n">Axis</span><span class="p">):</span>
                <span class="n">tmparg</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camlookat</span><span class="o">=</span><span class="n">tmparg</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmparg</span><span class="p">,</span> <span class="n">PlotProperties</span><span class="p">):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camlookat</span><span class="o">=</span><span class="n">tmparg</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
                    <span class="s">&quot;camlookat: object must be either </span><span class="si">%s</span><span class="s"> or </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                    <span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">Axis</span><span class="p">),</span> <span class="nb">type</span><span class="p">(</span><span class="n">PlotProperties</span><span class="p">),</span> <span class="nb">type</span><span class="p">(</span><span class="n">tmparg</span><span class="p">)))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camlookat: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camproj"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camproj">[docs]</a>    <span class="k">def</span> <span class="nf">camproj</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Camera projection.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camproj()</span>

<span class="sd">        returns the camera projection of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camproj(projeciton)</span>

<span class="sd">        sets the projection of the camera to projection, where projection can</span>
<span class="sd">        be either &#39;orthographic&#39; (default) or &#39;perspective&#39;.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camproj(ax, ...)</span>

<span class="sd">        sets or gets the camera projection of the Axis object ax instead of</span>
<span class="sd">        the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">cam</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camproj&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camproj</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camproj: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camup"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camup">[docs]</a>    <span class="k">def</span> <span class="nf">camup</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Camera up vector.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camup()</span>

<span class="sd">        returns the up vector of the camera in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camup([x, y, z])</span>

<span class="sd">        sets the camera up vector.</span>

<span class="sd">        Calling::</span>

<span class="sd">             camup(x, y, z)</span>

<span class="sd">        is the same as the above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camup(ax, ...)</span>

<span class="sd">        sets or gets the up vector for the camera in the Axis object ax</span>
<span class="sd">        instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">cam</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camup&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camup</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camup</span><span class="o">=</span><span class="n">args</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camup: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camroll"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camroll">[docs]</a>    <span class="k">def</span> <span class="nf">camroll</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Roll camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camroll(angle)</span>

<span class="sd">        rotates the camera about the direction of projection.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camroll(ax, ...)</span>

<span class="sd">        rotates the camera in the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camroll</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camroll: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camva"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camva">[docs]</a>    <span class="k">def</span> <span class="nf">camva</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Camera view angle.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camva()</span>

<span class="sd">        returns the camera view angle of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camva(angle)</span>

<span class="sd">        sets the camera view angle.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camva(ax, ...)</span>

<span class="sd">        sets or gets the camera view angle in the Axis object ax instead of</span>
<span class="sd">        the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">cam</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camva&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camva</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camva: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camzoom"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camzoom">[docs]</a>    <span class="k">def</span> <span class="nf">camzoom</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Zoom camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camzoom(factor)</span>

<span class="sd">        zooms the camera the specified factor. A value greater than 1 is a</span>
<span class="sd">        zoom-in, while a value less than 1 is a zoom-out.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camzoom(ax, ...)</span>

<span class="sd">        zooms the camera in the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camzoom</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camzoom: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.campos"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.campos">[docs]</a>    <span class="k">def</span> <span class="nf">campos</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Camera position.</span>

<span class="sd">        Calling::</span>

<span class="sd">            campos()</span>

<span class="sd">        returns the position of the camera in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            campos([x,y,z])</span>

<span class="sd">        sets the camera position.</span>

<span class="sd">        Calling::</span>

<span class="sd">             campos(x,y,z)</span>

<span class="sd">        is the same as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            campos(ax, ...)</span>

<span class="sd">        sets or gets the position of the camera in the Axis object ax instead</span>
<span class="sd">        of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">cam</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;campos&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">campos</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">campos</span><span class="o">=</span><span class="n">args</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;campos: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camtarget"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camtarget">[docs]</a>    <span class="k">def</span> <span class="nf">camtarget</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Camera target.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camtarget()</span>

<span class="sd">        returns the camera target of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camtarget([x,y,z])</span>

<span class="sd">        sets the target for the camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camtarget(x,y,z)</span>

<span class="sd">        is the same as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camtarget(ax, ...)</span>

<span class="sd">        sets or gets the camera target in the Axis object ax instead of the</span>
<span class="sd">        current axis..</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cam</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">cam</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camtarget&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camtarget</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">cam</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">camtarget</span><span class="o">=</span><span class="n">args</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;camtarget: wrong number of arguments&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.camlight"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.camlight">[docs]</a>    <span class="k">def</span> <span class="nf">camlight</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Create or set position of a light.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(&#39;headlight&#39;)</span>

<span class="sd">        creates a light in the current axis at the position of the camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(&#39;right&#39;)</span>

<span class="sd">        creates a light right and up from the camera in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(&#39;left&#39;)</span>

<span class="sd">        creates a light left and up from the camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight()</span>

<span class="sd">        is the same as camlight(&#39;right&#39;).</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(azimuth, elevation)</span>

<span class="sd">        creates a light at azimuth, elevation (both given in degrees) from</span>
<span class="sd">        the camera.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(..., style)</span>

<span class="sd">        sets the style of the light, where style can be either &#39;local&#39;</span>
<span class="sd">        (default) or &#39;inifinite&#39;.</span>

<span class="sd">        Calling::</span>

<span class="sd">            camlight(l, ...)</span>

<span class="sd">        places Light object l at the specified position.</span>

<span class="sd">        @return: A Light object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="c"># should be implemented in backend</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&quot;&#39;camlight&#39; not implemented in class </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.light"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.light">[docs]</a>    <span class="k">def</span> <span class="nf">light</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Add a light to the current axis.</span>

<span class="sd">        Calling:</span>

<span class="sd">            light()</span>

<span class="sd">        will add a light to the current axis with default values for all</span>
<span class="sd">        light properties.</span>

<span class="sd">        Calling::</span>

<span class="sd">            light(prop1=value1, prop2=value2, ...)</span>

<span class="sd">        adds a light with properties as given in the keyword arguments.</span>

<span class="sd">        @return: A Light object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">l</span> <span class="o">=</span> <span class="n">Light</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">light</span><span class="o">=</span><span class="n">l</span><span class="p">)</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
        <span class="k">return</span> <span class="n">l</span>
</div>
<div class="viewcode-block" id="BaseClass.colormap"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.colormap">[docs]</a>    <span class="k">def</span> <span class="nf">colormap</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Specify colormap.</span>

<span class="sd">        Calling::</span>

<span class="sd">            colormap(map)</span>

<span class="sd">        uses the colormap in map as the current colormap (map is dependent</span>
<span class="sd">        on the current backend).</span>

<span class="sd">        Calling::</span>

<span class="sd">            colormap(&#39;default&#39;)</span>

<span class="sd">        sets the colormap to the default colormap, i.e., jet.</span>

<span class="sd">        Calling::</span>

<span class="sd">            map = colormap()</span>

<span class="sd">        returns the current colormap.</span>

<span class="sd">        Calling::</span>

<span class="sd">            colormap(ax, ...)</span>

<span class="sd">        uses the figure corresponding to the Axis object ax instead of the</span>
<span class="sd">        current figure.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="k">return</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;colormap&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;default&#39;</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">colormap</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">jet</span><span class="p">())</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">colormap</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="c"># backend dependent</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;colormap: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.caxis"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.caxis">[docs]</a>    <span class="k">def</span> <span class="nf">caxis</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Set the limits for the color axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            caxis([cmin, cmax])</span>

<span class="sd">        changes the limits for the color axis to range from cmin to cmax.</span>

<span class="sd">        Calling::</span>

<span class="sd">             caxis(cmin, cmax)</span>

<span class="sd">        gives the same result as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            caxis(&#39;manual&#39;)</span>

<span class="sd">        freezes the limits at the current range.</span>

<span class="sd">        Calling::</span>

<span class="sd">            caxis(&#39;auto&#39;)</span>

<span class="sd">        uses autoranging for the color axis limits (default).</span>

<span class="sd">        Calling::</span>

<span class="sd">            cmin, cmax = caxis()</span>

<span class="sd">        returns the current color axis limits.</span>

<span class="sd">        Calling::</span>

<span class="sd">            caxis(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">cmin</span><span class="p">,</span> <span class="n">cmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;caxis&#39;</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">cmin</span> <span class="ow">is</span> <span class="bp">None</span> <span class="ow">or</span> <span class="n">cmax</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span>
                <span class="n">cmin</span><span class="p">,</span> <span class="n">cmax</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;zlim&#39;</span><span class="p">)</span>
            <span class="k">return</span> <span class="n">cmin</span><span class="p">,</span> <span class="n">cmax</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span>  <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
            <span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">str</span><span class="p">)</span> <span class="ow">and</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="p">[</span><span class="s">&#39;auto&#39;</span><span class="p">,</span> <span class="s">&#39;manual&#39;</span><span class="p">]:</span>
                <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">caxismode</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;caxis: argument must be </span><span class="si">%s</span><span class="s">, not </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                <span class="p">((</span><span class="nb">type</span><span class="p">(</span><span class="nb">list</span><span class="p">),</span><span class="nb">type</span><span class="p">(</span><span class="nb">tuple</span><span class="p">),</span><span class="nb">type</span><span class="p">(</span><span class="nb">str</span><span class="p">)),</span>
                                 <span class="nb">type</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])))</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">caxis</span><span class="o">=</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.colorbar"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.colorbar">[docs]</a>    <span class="k">def</span> <span class="nf">colorbar</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Display a color bar.</span>

<span class="sd">        Calling::</span>

<span class="sd">            colorbar()</span>

<span class="sd">        displays a colorbar in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            colorbar(&#39;off&#39;)</span>

<span class="sd">        removes the colorbar from the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            colorbar(loc)</span>

<span class="sd">        displays a colorbar in the current axis at the location specified by</span>
<span class="sd">        loc, where loc may be any of the following:</span>

<span class="sd">          * &#39;North&#39;        - inside plot box near top</span>
<span class="sd">          * &#39;South&#39;        - inside bottom</span>
<span class="sd">          * &#39;East&#39;         - inside right</span>
<span class="sd">          * &#39;West&#39;         - inside left</span>
<span class="sd">          * &#39;NorthOutside&#39; - outside plot box near top</span>
<span class="sd">          * &#39;SouthOutside&#39; - outside bottom</span>
<span class="sd">          * &#39;EastOutside&#39;  - outside right</span>
<span class="sd">          * &#39;WestOutside&#39;  - outside left</span>

<span class="sd">        Calling::</span>

<span class="sd">            colorbar(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        @return: A Colorbar object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="n">cbar</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;colorbar&#39;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">cbar</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">visible</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">&#39;off&#39;</span> <span class="ow">or</span> <span class="ow">not</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]:</span>
                <span class="n">cbar</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">visible</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">cbar</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">visible</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
                <span class="n">cbar</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">cblocation</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;colorbar: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>

        <span class="k">return</span> <span class="n">cbar</span>
</div>
<div class="viewcode-block" id="BaseClass.shading"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.shading">[docs]</a>    <span class="k">def</span> <span class="nf">shading</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Control the color shading of surfaces.</span>

<span class="sd">        Calling::</span>

<span class="sd">            shading(mode)</span>

<span class="sd">        changes the shading mode in the current axis to the one specified by</span>
<span class="sd">        by mode. Valid modes are &#39;flat&#39;, &#39;interp&#39; (interpolated or Gouraud)</span>
<span class="sd">        and &#39;faceted&#39; (default).</span>

<span class="sd">        Calling::</span>

<span class="sd">            shading(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">shading</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]))</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;shading: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.brighten"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.brighten">[docs]</a>    <span class="k">def</span> <span class="nf">brighten</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Brighten or darken the color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&quot;&#39;brighten&#39; not implemented in class </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.clabel"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.clabel">[docs]</a>    <span class="k">def</span> <span class="nf">clabel</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Control labeling of contours.</span>

<span class="sd">        Calling::</span>

<span class="sd">            clabel(obj, &#39;on&#39;)</span>

<span class="sd">        adds height labels to a contour plot (obj must be a Contours</span>
<span class="sd">        object).</span>

<span class="sd">        Calling::</span>

<span class="sd">            clabel(obj, &#39;off&#39;)</span>

<span class="sd">        removes the labeling of the contour lines (default).</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
            <span class="n">obj</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
            <span class="n">state</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
            <span class="n">obj</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">clabels</span><span class="o">=</span><span class="n">state</span><span class="p">)</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;clabel: wrong number of arguments&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.box"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.box">[docs]</a>    <span class="k">def</span> <span class="nf">box</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Display a box around the boundaries of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            box(&#39;on&#39;)</span>

<span class="sd">        displays a box at the boundaries of the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            box(&#39;off&#39;)</span>

<span class="sd">        turns off the box.</span>

<span class="sd">        Calling::</span>

<span class="sd">            box()</span>

<span class="sd">        toggles the display of a box in the current axis.</span>

<span class="sd">        Calling::</span>

<span class="sd">            box(ax, ...)</span>

<span class="sd">        uses the Axis object ax instead of the current axis.</span>

<span class="sd">        Note: box(True) and box(False) is the same as box(&#39;on&#39;) and</span>
<span class="sd">        box(&#39;off&#39;), respectively.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">ax</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">nargs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_check_args</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">toggle</span><span class="p">(</span><span class="s">&#39;box&#39;</span><span class="p">)</span>
        <span class="k">elif</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="n">ax</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="n">box</span><span class="o">=</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">TypeError</span><span class="p">(</span><span class="s">&quot;box: wrong number of argumnts&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>
</div>
<div class="viewcode-block" id="BaseClass.material"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.material">[docs]</a>    <span class="k">def</span> <span class="nf">material</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Set the material reflectance mode.</span>

<span class="sd">        Calling::</span>

<span class="sd">            material([ka, kd, ks[, n[, sc]]])</span>

<span class="sd">        changes the ambient/diffuse/specular strength, specular exponent,</span>
<span class="sd">        and specular color reflectance of objects.</span>

<span class="sd">        Calling::</span>

<span class="sd">            material(ka, kd, ks[, n[, sc]])</span>

<span class="sd">        is the same as above.</span>

<span class="sd">        Calling::</span>

<span class="sd">            material(mode)</span>

<span class="sd">        sets the material mode, where mode can be one of the following</span>
<span class="sd">        strings:</span>

<span class="sd">          * &#39;shiny&#39;   - shiny objects</span>
<span class="sd">          * &#39;dull&#39;,   - dull objects</span>
<span class="sd">          * &#39;metal&#39;   - metallic objects</span>
<span class="sd">          * &#39;default&#39; - default material properties</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">modes</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;shiny&#39;</span><span class="p">:</span> <span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span>
                 <span class="s">&#39;dull&#39;</span><span class="p">:</span> <span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span>
                 <span class="s">&#39;metal&#39;</span><span class="p">:</span> <span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span>
                 <span class="s">&#39;default&#39;</span><span class="p">:</span> <span class="p">(</span><span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">,</span> <span class="bp">None</span><span class="p">),</span>
                 <span class="p">}</span>
        <span class="n">ka</span><span class="p">,</span> <span class="n">kd</span><span class="p">,</span> <span class="n">ks</span><span class="p">,</span> <span class="n">n</span><span class="p">,</span> <span class="n">sc</span> <span class="o">=</span> <span class="n">modes</span><span class="p">[</span><span class="s">&#39;default&#39;</span><span class="p">]</span>
        <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
            <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="p">(</span><span class="nb">tuple</span><span class="p">,</span><span class="nb">list</span><span class="p">)):</span>
                <span class="n">args</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
                <span class="n">nargs</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>
            <span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">in</span> <span class="n">modes</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
                <span class="n">ka</span><span class="p">,</span> <span class="n">kd</span><span class="p">,</span> <span class="n">ks</span><span class="p">,</span> <span class="n">n</span><span class="p">,</span> <span class="n">sc</span> <span class="o">=</span> <span class="n">modes</span><span class="p">[</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>

        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">3</span><span class="p">:</span>
            <span class="n">ka</span><span class="p">,</span> <span class="n">kd</span><span class="p">,</span> <span class="n">ks</span> <span class="o">=</span> <span class="n">args</span><span class="p">[:</span><span class="mi">3</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&gt;=</span> <span class="mi">4</span><span class="p">:</span>
            <span class="n">n</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">==</span> <span class="mi">5</span><span class="p">:</span>
            <span class="n">sc</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span>
        <span class="k">if</span> <span class="n">nargs</span> <span class="o">&lt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">nargs</span> <span class="o">&gt;</span> <span class="mi">5</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s">&quot;material: wrong nmumber of arguments&quot;</span><span class="p">)</span>

        <span class="n">kwargs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="k">if</span> <span class="n">ka</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;ambient&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ka</span>
        <span class="k">if</span> <span class="n">kd</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;diffuse&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">kd</span>
        <span class="k">if</span> <span class="n">ks</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;specular&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ks</span>
        <span class="k">if</span> <span class="n">n</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
            <span class="n">kwargs</span><span class="p">[</span><span class="s">&#39;specularpower&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">n</span>
        <span class="c">#if sc is not None:</span>
            <span class="c">#kwargs[&#39;specularcolorreflectance&#39;] = sc</span>

        <span class="n">ax</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span>
        <span class="n">items</span> <span class="o">=</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)</span>
        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;numberofitems&#39;</span><span class="p">)):</span>
            <span class="n">items</span><span class="p">[</span><span class="n">i</span><span class="p">]</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;material&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">setp</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;interactive&#39;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;show&#39;</span><span class="p">):</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_replot</span><span class="p">()</span>

    <span class="c"># Colormap methods:</span></div>
<div class="viewcode-block" id="BaseClass.hsv"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.hsv">[docs]</a>    <span class="k">def</span> <span class="nf">hsv</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Hue-saturation-value color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;hsv not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.hot"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.hot">[docs]</a>    <span class="k">def</span> <span class="nf">hot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Black-red-yellow-white color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;hot not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.gray"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.gray">[docs]</a>    <span class="k">def</span> <span class="nf">gray</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Linear gray-scale color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;gray not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.bone"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.bone">[docs]</a>    <span class="k">def</span> <span class="nf">bone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Gray-scale with a tinge of blue color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;bone not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.copper"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.copper">[docs]</a>    <span class="k">def</span> <span class="nf">copper</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Linear copper-tone color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;copper not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.pink"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.pink">[docs]</a>    <span class="k">def</span> <span class="nf">pink</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Pastel shades of pink color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;pink not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.white"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.white">[docs]</a>    <span class="k">def</span> <span class="nf">white</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;All white color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;white not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.flag"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.flag">[docs]</a>    <span class="k">def</span> <span class="nf">flag</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Alternating red, white, blue, and black color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;flag not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.lines"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.lines">[docs]</a>    <span class="k">def</span> <span class="nf">lines</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Color map with the line colors.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;lines not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.colorcube"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.colorcube">[docs]</a>    <span class="k">def</span> <span class="nf">colorcube</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Enhanced color-cube color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;colorcube not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.vga"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.vga">[docs]</a>    <span class="k">def</span> <span class="nf">vga</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Windows colormap for 16 colors.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;vga not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.jet"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.jet">[docs]</a>    <span class="k">def</span> <span class="nf">jet</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Variant of hsv.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;jet not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.prism"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.prism">[docs]</a>    <span class="k">def</span> <span class="nf">prism</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Prism color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;prism not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.cool"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.cool">[docs]</a>    <span class="k">def</span> <span class="nf">cool</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Shades of cyan and magenta color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;cool not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.autumn"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.autumn">[docs]</a>    <span class="k">def</span> <span class="nf">autumn</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Shades of red and yellow color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;autumn not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.spring"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.spring">[docs]</a>    <span class="k">def</span> <span class="nf">spring</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Shades of magenta and yellow color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;spring not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.winter"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.winter">[docs]</a>    <span class="k">def</span> <span class="nf">winter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Shades of blue and green color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;winter not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>
</div>
<div class="viewcode-block" id="BaseClass.summer"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.BaseClass.summer">[docs]</a>    <span class="k">def</span> <span class="nf">summer</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">m</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Shades of green and yellow color map.&quot;&quot;&quot;</span>
        <span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s">&#39;summer not implemented in class </span><span class="si">%s</span><span class="s">&#39;</span> <span class="o">%</span> \
                                  <span class="bp">self</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span><span class="p">)</span>

</div></div>
<span class="k">def</span> <span class="nf">turn_off_plotting</span><span class="p">(</span><span class="n">namespace</span><span class="o">=</span><span class="nb">globals</span><span class="p">()):</span>
    <span class="sd">&quot;&quot;&quot;Call turn_off_plotting(globals()) to turn off all plotting.&quot;&quot;&quot;</span>
    <span class="n">use</span><span class="p">(</span><span class="n">namespace</span><span class="p">[</span><span class="s">&#39;plt&#39;</span><span class="p">],</span> <span class="n">namespace</span><span class="p">,</span> <span class="bp">True</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">use</span><span class="p">(</span><span class="n">plt</span><span class="p">,</span> <span class="n">namespace</span><span class="o">=</span><span class="nb">globals</span><span class="p">(),</span> <span class="n">neutralize</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Export the namespace of backend instance to namespace.</span>
<span class="sd">    If neutralize is True, the plt object will be replaced</span>
<span class="sd">    by a scitools.misc.DoNothing object so that no plotting</span>
<span class="sd">    command will do anything. This can be used to efficiently</span>
<span class="sd">    turn off all plotting in a program.</span>
<span class="sd">    Just call turn_off_plotting(globals()) before the first</span>
<span class="sd">    plot command in your program.</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="n">plt_dict</span> <span class="o">=</span> <span class="p">{}</span>
    <span class="n">plt_orig</span> <span class="o">=</span> <span class="n">plt</span>
    <span class="k">if</span> <span class="n">neutralize</span><span class="p">:</span>
        <span class="kn">import</span> <span class="nn">scitools.misc</span>
        <span class="n">plt</span> <span class="o">=</span> <span class="n">scitools</span><span class="o">.</span><span class="n">misc</span><span class="o">.</span><span class="n">DoNothing</span><span class="p">()</span>
    <span class="n">plt_dict</span><span class="p">[</span><span class="s">&#39;plt&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">plt</span>
    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">plt_orig</span><span class="o">.</span><span class="n">__dict__</span><span class="p">:</span>
        <span class="n">plt_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="nb">eval</span><span class="p">(</span><span class="s">&#39;plt.&#39;</span><span class="o">+</span><span class="n">item</span><span class="p">)</span>
    <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">dir</span><span class="p">(</span><span class="n">plt_orig</span><span class="o">.</span><span class="n">__class__</span><span class="p">):</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="s">&#39;__&#39;</span> <span class="ow">in</span> <span class="n">item</span><span class="p">:</span>
            <span class="n">plt_dict</span><span class="p">[</span><span class="n">item</span><span class="p">]</span> <span class="o">=</span> <span class="nb">eval</span><span class="p">(</span><span class="s">&#39;plt.&#39;</span><span class="o">+</span><span class="n">item</span><span class="p">)</span>
    <span class="n">namespace</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">plt_dict</span><span class="p">)</span>  <span class="c"># Add to global namespace</span>
    <span class="n">namespace</span><span class="p">[</span><span class="s">&#39;savefig&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">namespace</span><span class="p">[</span><span class="s">&#39;hardcopy&#39;</span><span class="p">]</span>   <span class="c"># synonym</span>
    <span class="k">def</span> <span class="nf">get_backend</span><span class="p">():</span>
        <span class="k">return</span> <span class="n">plt</span><span class="o">.</span><span class="n">_g</span>
    <span class="n">namespace</span><span class="p">[</span><span class="s">&#39;get_backend&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">get_backend</span> <span class="c"># desired global func</span>

    <span class="c"># If this module is imported</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="n">__all__</span>
    <span class="k">except</span><span class="p">:</span>
        <span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;plt&#39;</span><span class="p">]</span>
    <span class="k">try</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">plt_dict</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
            <span class="n">__all__</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
    <span class="k">except</span><span class="p">:</span>
        <span class="k">pass</span>
    <span class="k">del</span><span class="p">(</span><span class="n">__all__</span><span class="p">)</span>


<div class="viewcode-block" id="debug"><a class="viewcode-back" href="../../../common.html#scitools.easyviz.common.debug">[docs]</a><span class="k">def</span> <span class="nf">debug</span><span class="p">(</span><span class="n">plt</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="mi">10</span><span class="p">):</span>

    <span class="k">def</span> <span class="nf">print_</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">spaces</span><span class="o">=</span><span class="mi">10</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Indent print&quot;&quot;&quot;</span>
        <span class="n">pref</span> <span class="o">=</span> <span class="s">&#39; &#39;</span><span class="o">*</span><span class="n">spaces</span>
        <span class="k">print</span> <span class="n">pref</span><span class="o">+</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="o">+</span><span class="n">pref</span><span class="p">)</span><span class="o">.</span><span class="n">join</span><span class="p">((</span><span class="nb">str</span><span class="p">(</span><span class="n">item</span><span class="p">))</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">))</span>

    <span class="k">print</span> <span class="s">&quot;plt:&quot;</span>
    <span class="k">print</span> <span class="n">plt</span>
    <span class="k">if</span> <span class="n">level</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
        <span class="k">for</span> <span class="n">fignr</span> <span class="ow">in</span> <span class="n">plt</span><span class="o">.</span><span class="n">_figs</span><span class="p">:</span>
            <span class="k">print</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">Fig </span><span class="si">%d</span><span class="s">:&quot;</span> <span class="o">%</span> <span class="n">fignr</span>
            <span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">_figs</span><span class="p">[</span><span class="n">fignr</span><span class="p">]</span>
            <span class="k">print</span> <span class="n">fig</span>

            <span class="k">if</span> <span class="n">level</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
                <span class="n">axes_</span> <span class="o">=</span> <span class="n">fig</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;axes&#39;</span><span class="p">)</span>
                <span class="k">for</span> <span class="n">axnr</span> <span class="ow">in</span> <span class="n">axes_</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
                    <span class="n">print_</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Ax </span><span class="si">%d</span><span class="s">:&quot;</span> <span class="o">%</span> <span class="n">axnr</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
                    <span class="n">ax</span> <span class="o">=</span> <span class="n">axes_</span><span class="p">[</span><span class="n">axnr</span><span class="p">]</span>
                    <span class="n">print_</span><span class="p">(</span><span class="n">ax</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>

                    <span class="k">if</span> <span class="n">level</span> <span class="o">&gt;</span> <span class="mi">2</span><span class="p">:</span>
                        <span class="n">print_</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Camera:&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
                        <span class="n">print_</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;camera&#39;</span><span class="p">),</span> <span class="mi">8</span><span class="p">)</span>

                        <span class="n">print_</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Colorbar:&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
                        <span class="n">print_</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;colorbar&#39;</span><span class="p">),</span> <span class="mi">8</span><span class="p">)</span>

                        <span class="n">print_</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Lights:&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
                        <span class="k">for</span> <span class="n">light_</span> <span class="ow">in</span> <span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;lights&#39;</span><span class="p">):</span>
                            <span class="n">print_</span><span class="p">(</span><span class="n">light_</span><span class="p">,</span> <span class="mi">8</span><span class="p">)</span>

                        <span class="n">print_</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Plotitems:&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
                        <span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">item</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">ax</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;plotitems&#39;</span><span class="p">)):</span>
                            <span class="n">print_</span><span class="p">(</span><span class="s">&#39;item number </span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">:&#39;</span> <span class="o">%</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="nb">repr</span><span class="p">(</span><span class="n">item</span><span class="p">)),</span> <span class="mi">8</span><span class="p">)</span>
                            <span class="n">print_</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>

                            <span class="k">if</span> <span class="n">level</span> <span class="o">&gt;</span> <span class="mi">3</span><span class="p">:</span>
                                <span class="n">print_</span><span class="p">(</span><span class="s">&quot;Material:&quot;</span><span class="p">,</span> <span class="mi">12</span><span class="p">)</span>
                                <span class="n">print_</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">getp</span><span class="p">(</span><span class="s">&#39;material&#39;</span><span class="p">),</span> <span class="mi">16</span><span class="p">)</span>

                            <span class="k">print</span> <span class="s">&#39;&#39;</span></div>
</pre></div>

          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../../../index.html">
              <img class="logo" src="../../../_static/scitools_logo.jpg" alt="Logo"/>
            </a></p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../../np-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li><a href="../../../index.html">SciTools 0.8.3 documentation</a> &raquo;</li>
          <li><a href="../../index.html" >Module code</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, H. P. Langtangen, J. Ring, ++.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
    </div>
  </body>
</html>